Ext.define("Deppon.config.Dpap", {
    statics: {
        RESOURCE_PATH: "http://192.168.17.167/dpap/dpap",
        USER_NOTALLOW: "ERROR.SECURITY.NOTALLOW"
    }
});
Ext.define("Deppon.config.Foss", {
    statics: {
        RESOURCE_PATH: Deppon.config.Dpap.RESOURCE_PATH,
        UPDATE_INFO_INTERVAL: 300,
        QUESTION_REPORT_URL: "http://192.168.17.103:8080/itsm/question.do",
        QUESTION_REPORT_PARAMS: ["system", "psnCode", "subsystem", "moduleName"],
        getRequestUrl: function (a, d, c) {
            if (Ext.isEmpty(d)) {
                return a
            }
            a = a + "?";
            for (var b = 0; b < d.length; b++) {
                if (b == d.length - 1) {
                    a = a + d[b] + "=" + c[b]
                } else {
                    a = a + d[b] + "=" + c[b] + "&"
                }
            }
            return a
        }
    }
});
Ext.BLANK_IMAGE_URL = Deppon.config.Foss.RESOURCE_PATH + "/images/default/tree/s.gif";
var split;
split = split || function (b) {
    var d = String.prototype.split, c = /()??/.exec("")[1] === b, a;
    a = function (m, j, i) {
        if (Object.prototype.toString.call(j) !== "[object RegExp]") {
            return d.call(m, j, i)
        }
        var g = [], h = (j.ignoreCase ? "i" : "") + (j.multiline ? "m" : "") + (j.extended ? "x" : "") + (j.sticky ? "y" : ""), e = 0, j = new RegExp(j.source, h + "g"), f, k, l, n;
        m += "";
        if (!c) {
            f = new RegExp("^" + j.source + "$(?!\\s)", h)
        }
        i = i === b ? -1 >>> 0 : i >>> 0;
        while (k = j.exec(m)) {
            l = k.index + k[0].length;
            if (l > e) {
                g.push(m.slice(e, k.index));
                if (!c && k.length > 1) {
                    k[0].replace(f, function () {
                        for (var o = 1; o < arguments.length - 2; o++) {
                            if (arguments[o] === b) {
                                k[o] = b
                            }
                        }
                    })
                }
                if (k.length > 1 && k.index < m.length) {
                    Array.prototype.push.apply(g, k.slice(1))
                }
                n = k[0].length;
                e = l;
                if (g.length >= i) {
                    break
                }
            }
            if (j.lastIndex === k.index) {
                j.lastIndex++
            }
        }
        if (e === m.length) {
            if (n || !j.test("")) {
                g.push("")
            }
        } else {
            g.push(m.slice(e))
        }
        return g.length > i ? g.slice(0, i) : g
    };
    String.prototype.split = function (f, e) {
        return a(this, f, e)
    };
    return a
}();
if (typeof String.prototype.trim !== "function") {
    String.prototype.trim = function () {
        return this.replace(/(^\s*)|(\s*$)/g, "")
    }
}
if (typeof Array.prototype.indexOf !== "function") {
    Array.prototype.indexOf = function (b) {
        for (var a = 0; a < this.length; a++) {
            if (this[a] == b) {
                return a
            }
        }
        return -1
    }
}
Ext.override(Ext.panel.Table, {
    onRestoreHorzScroll: function () {
        var a = this.scrollLeftPos;
        if (a) {
            this.syncHorizontalScroll(a, true)
        }
    }, syncHorizontalScroll: function (d, b) {
        var c = this, a;
        b = b === true;
        if (c.rendered && (b || d !== c.scrollLeftPos)) {
            if (b) {
                a = c.getScrollTarget();
                a.el.dom.scrollLeft = d
            }
            c.headerCt.el.dom.scrollLeft = d;
            c.scrollLeftPos = d
        }
    }
});
Ext.override(Ext.window.Window, {constrain: true});
Ext.override(Ext.view.Table, {enableTextSelection: true});
Ext.override(Ext.view.BoundList, {
    createPagingToolbar: function () {
        return Ext.widget("simplepaging", {
            id: this.id + "-paging-toolbar",
            pageSize: this.pageSize,
            store: this.store,
            border: false
        })
    }
});
Ext.override(Ext.form.FieldContainer, {
    allowBlank: true,
    beforeLabelTextTpl: new Ext.XTemplate('<tpl if="!allowBlank">', '<font color="red">*</font>', "</tpl>", '<tpl if="allowBlank">', "&nbsp;&nbsp;", "</tpl>")
});
Ext.override(Ext.form.field.Base, {
    getSubTplData: function () {
        var a = this.callParent();
        if (!a.hasOwnProperty("maxLength")) {
            a.maxLength = undefined
        }
        return a
    }
});
Ext.override(Ext.view.AbstractView, {
    onRender: function () {
        var a = this;
        a.callParent();
        if (a.mask && Ext.isObject(a.store)) {
            a.setMaskBind(a.store)
        }
    }
});
Ext.override(Ext.form.field.Date, {
    safeParse: function (f, g) {
        var e = this, c = Ext.Date, a = null, b = e.useStrict, d;
        if (c.formatContainsHourInfo(g)) {
            a = c.parse(f, g, b)
        } else {
            if (g == "Y-m") {
                d = c.parse(f + "-01 " + e.initTime, g + "-d " + e.initTimeFormat, b);
                if (d) {
                    a = c.clearTime(d)
                }
            } else {
                d = c.parse(f + " " + e.initTime, g + " " + e.initTimeFormat, b);
                if (d) {
                    a = c.clearTime(d)
                }
            }
        }
        return a
    }
});
Ext.override(Ext.form.field.Text, {
    getErrors: function (l) {
        var g = this, k = [], a = g.validator, d = g.emptyText, c = g.allowBlank, e = g.vtype, h = Ext.form.field.VTypes, i = g.regex, j = Ext.String.format, b;
        l = l || g.processRawValue(g.getRawValue());
        if (Ext.isFunction(a)) {
            b = a.call(g, l);
            if (b !== true) {
                k.push(b)
            }
        }
        var f = l.toString().trim();
        if (f.length < 1 || f === d) {
            if (!c) {
                k.push(g.blankText)
            }
            return k
        }
        if (l.length < g.minLength) {
            k.push(j(g.minLengthText, g.minLength))
        }
        if (l.length > g.maxLength) {
            k.push(j(g.maxLengthText, g.maxLength))
        }
        if (e) {
            if (!h[e](l, g)) {
                k.push(g.vtypeText || h[e + "Text"])
            }
        }
        if (i && !i.test(l)) {
            k.push(g.regexText || g.invalidText)
        }
        return k
    }
});
Ext.form.field.Trigger.override({
    setReadOnly: function (h) {
        var e = this, f = e.hideTrigger, g = e.inputEl;
        h = !!h;
        if (h == e.readOnly) {
            return
        }
        e[h ? "addCls" : "removeCls"](e.readOnlyCls);
        if (!f && e.triggerEl && e.triggerEl.elements) {
            var a = e.triggerEl.elements.length, b, d, c;
            if (h) {
                for (b = 0; b < a; b++) {
                    d = e.triggerEl.elements[b];
                    c = d.dom.parentElement;
                    c.style.display = "none";
                    d.dom.style.display = "none"
                }
            } else {
                for (b = 0; b < a; b++) {
                    d = e.triggerEl.elements[b];
                    c = d.dom.parentElement;
                    c.style.display = "block";
                    d.dom.style.display = "block"
                }
            }
        }
        if (g) {
            g.dom.readOnly = h;
            if (h) {
                g.dom.style.cursor = "default";
                if (Ext.fly(g.id + "-prefix") && Ext.fly(g.id + "-prefix").dom) {
                    Ext.fly(g.id + "-prefix").dom.innerHTML = "&nbsp;&nbsp;"
                }
                if (Ext.fly(e.id + "-errorEl") && Ext.fly(e.id + "-errorEl").dom) {
                    Ext.fly(e.id + "-errorEl").dom.style.visibility = "hidden"
                }
            } else {
                g.dom.style.cursor = "text";
                if (!e.allowBlank && Ext.fly(g.id + "-prefix") && Ext.fly(g.id + "-prefix").dom) {
                    Ext.fly(g.id + "-prefix").dom.innerHTML = "*"
                }
                if (Ext.fly(e.id + "-errorEl") && Ext.fly(e.id + "-errorEl").dom) {
                    Ext.fly(e.id + "-errorEl").dom.style.visibility = "visible"
                }
            }
        } else {
            if (e.rendering) {
                e.setReadOnlyOnBoxReady = true
            }
        }
        if (h != e.readOnly) {
            e.readOnly = h;
            e.updateLayout()
        }
    }
});
Ext.override(Ext.form.field.Checkbox, {
    selectReadOnlyCls: Ext.baseCSSPrefix + "form-selection-readonly",
    beforeRender: function () {
        var a = this;
        a.callParent(arguments);
        a.beforeLabelableRender(arguments);
        if (a.readOnly) {
            a.removeCls(a.readOnlyCls);
            a.addCls(a.selectReadOnlyCls)
        }
    },
    setReadOnly: function (c) {
        var a = this, b = a.inputEl;
        c = !!c;
        a[c ? "addCls" : "removeCls"](a.selectReadOnlyCls);
        a.readOnly = c;
        if (b) {
            b.dom.disabled = !!c || a.disabled;
            b.dom.readOnly = c
        } else {
            if (a.rendering) {
                a.setReadOnlyOnBoxReady = true
            }
        }
        a.fireEvent("writeablechange", a, c)
    }
});
Ext.override(Ext.form.field.Base, {
    msgTarget: "side",
    tipConfig: "",
    labelableRenderProps: "readOnly,allowBlank,labelAlign,fieldBodyCls,baseBodyCls,clearCls,labelSeparator,msgTarget",
    beforeLabelTextTpl: new Ext.XTemplate('<tpl if="!allowBlank">', '<tpl if="!readOnly">', '<label id="{inputId}-prefix" style="color:red">*</label>', "</tpl>", '<tpl if="readOnly">', '<label id="{inputId}-prefix" style="color:red">&nbsp;&nbsp;</label>', "</tpl>", "</tpl>", '<tpl if="allowBlank">', '<label id="{inputId}-prefix" style="color:red">&nbsp;&nbsp;</label>', "</tpl>"),
    isValid: function () {
        var b = this, a = b.disabled, c = b.forceValidation || !a;
        if (b.readOnly && b.allowBlank) {
            return true
        } else {
            return c ? b.validateValue(b.processRawValue(b.getRawValue())) : a
        }
    },
    setReadOnly: function (c) {
        var a = this, b = a.inputEl;
        c = !!c;
        a[c ? "addCls" : "removeCls"](a.readOnlyCls);
        a.readOnly = c;
        if (b) {
            b.dom.readOnly = c;
            if (a.readOnly) {
                Ext.fly(b.id + "-prefix").dom.innerHTML = "&nbsp;&nbsp;";
                if (Ext.fly(a.id + "-errorEl")) {
                    Ext.fly(a.id + "-errorEl").dom.style.visibility = "hidden"
                }
            } else {
                if (!a.allowBlank) {
                    Ext.fly(b.id + "-prefix").dom.innerHTML = "*"
                }
                Ext.fly(a.id + "-errorEl").dom.style.visibility = "visible"
            }
        } else {
            if (a.rendering) {
                a.setReadOnlyOnBoxReady = true
            }
        }
        a.fireEvent("writeablechange", a, c)
    },
    initComponent: function () {
        var a = this;
        a.callParent();
        a.subTplData = a.subTplData || {};
        a.addEvents("specialkey", "writeablechange");
        a.initLabelable();
        a.initField();
        if (!a.name) {
            a.name = a.getInputId()
        }
        a.on("render", function (e) {
            if (e.tipConfig) {
                e.tipConfig.target = e.id;
                if (e.tipConfig.tipType != "normal") {
                    var f = e.tipConfig.depth, c = e, d;
                    for (var b = 0; b < f; b++) {
                        c = c.up()
                    }
                    e.tipConfig.data = c.tipData
                }
                d = Ext.create("Ext.tip.ToolTip", e.tipConfig);
                d.on("beforeshow", function (h, g) {
                    if (e.tipConfig.isShowByData) {
                        if (Ext.isEmpty(e.getValue())) {
                            return false
                        }
                    }
                });
                if (e.tipConfig.tipBodyElement) {
                    d.bodyElement = null;
                    d.on("show", function (i, g) {
                        var h = i.bodyElement;
                        if (!h) {
                            h = Ext.create(e.tipConfig.tipBodyElement);
                            h.render(i.id + "-body");
                            i.bodyElement = h
                        }
                        h.bindData(e.getValue())
                    })
                }
            }
        })
    }
});
Ext.override(Ext.selection.CheckboxModel, {
    renderer: function (g, a, c, e, i, h, f) {
        var d = this;
        if (d.hasListener("beforerenderer") && d.fireEvent("beforerenderer", c, h)) {
            d.unSelectRecords.push(c);
            return "<div>&#160;</div>"
        }
        var b = Ext.baseCSSPrefix;
        a.tdCls = b + "grid-cell-special " + b + "grid-cell-row-checker";
        return '<div class="' + b + 'grid-row-checker">&#160;</div>'
    }, constructor: function () {
        var a = this;
        a.callParent(arguments);
        a.unSelectRecords = new Array();
        a.addEvents("beforerenderer")
    }, onRowMouseDown: function (b, a, g, d, h) {
        b.el.focus();
        var f = this, c = h.getTarget("." + Ext.baseCSSPrefix + "grid-row-checker"), i;
        if (Ext.Array.contains(f.unSelectRecords, a)) {
            return
        }
        if (!f.allowRightMouseSelection(h)) {
            return
        }
        if (f.checkOnly && !c) {
            return
        }
        if (c) {
            i = f.getSelectionMode();
            if (i !== "SINGLE") {
                f.setSelectionMode("SIMPLE")
            }
            f.selectWithEvent(a, h);
            f.setSelectionMode(i)
        } else {
            f.selectWithEvent(a, h)
        }
    }, onHeaderClick: function (b, d, f) {
        if (d.isCheckerHd) {
            f.stopEvent();
            var h = this, c = d.el.hasCls(Ext.baseCSSPrefix + "grid-hd-checker-on");
            h.preventFocus = true;
            if (c) {
                h.deselectAll()
            } else {
                h.selectAll();
                if (h.unSelectRecords.length > 0) {
                    h.deselect(h.unSelectRecords);
                    d.el.addCls(Ext.baseCSSPrefix + "grid-hd-checker-on")
                }
            }
            delete h.preventFocus;
            var a = h.selected.getCount(), g = h.store.getCount(), i = h.views[0], b = i.headerCt, j = b.child("gridcolumn[isCheckerHd]");
            if (a != g) {
                if (c) {
                    j.el.removeCls(this.checkerOnCls)
                }
            }
        }
    }
});
Ext.override(Ext.selection.RowModel, {
    onKeyLeft: function (a) {
        this.scrollByDeltaX(-this.deltaScroll);
        return true
    }, onKeyRight: function (a) {
        this.scrollByDeltaX(this.deltaScroll);
        return true
    }
});
Ext.override(Ext.grid.header.Container, {
    onHeaderClick: function (c, b, a) {
        c.focus();
        c.fireEvent("headerclick", this, c, b, a);
        this.fireEvent("headerclick", this, c, b, a)
    }
});
Ext.override(Ext.data.Connection, {
    onJsonResponse: function (e, a, c) {
        if (e.toLowerCase() == "application/json;charset=utf-8") {
            var d = Ext.decode(a.responseText);
            if (d) {
                if (d.success && !d.isException) {
                    Ext.callback(c.success, c.scope, [a, c])
                } else {
                    if (!d.success && !d.isException) {
                        Ext.callback(c.exception, c.scope, [a, c])
                    } else {
                        if (!d.success && d.isException) {
                            if (d.stackTrace && d.stackTrace.indexOf("UserNotLoginException") > 0) {
                                Deppon.errorMessage.Box.showGoLoginWin();
                                return
                            }
                            if (d.errorCode == Deppon.config.Dpap.USER_NOTALLOW) {
                                Ext.ux.Toast.msg("", d.message, "error")
                            } else {
                                var b = Ext.create("Deppon.errorMessage.Window", {
                                    message: d.message,
                                    stackTrace: d.stackTrace
                                });
                                b.show()
                            }
                            Ext.callback(c.unknownException, c.scope, [a, c])
                        }
                    }
                }
            }
        } else {
            if (a.responseText != null) {
                if (a.responseText.indexOf('<meta content="LOGIN_JSP">') > 0) {
                    Deppon.errorMessage.Box.showGoLoginWin();
                    return
                }
            }
            Ext.callback(c.success, c.scope, [a, c])
        }
    }, onUploadComplete: function (a, j) {
        var g = this, b = {responseText: "", responseXML: null}, i, h, f, d = false;
        try {
            h = a.contentWindow.document || a.contentDocument || window.frames[a.id].document;
            if (h) {
                if (h.body) {
                    if (/pre/i.test((f = h.body.firstChild || {}).tagName)) {
                        b.responseText = f.innerHTML;
                        i = "application/json;charset=utf-8"
                    } else {
                        b.responseText = h.body.innerHTML;
                        i = "text/html"
                    }
                }
                b.responseXML = h.XMLDocument || h;
                g.onJsonResponse(i, b, j);
                d = true
            }
        } catch (c) {
            console.log(c)
        }
        g.fireEvent("requestcomplete", g, b, j);
        if (!d) {
            Ext.callback(j.callback, j.scope, [j, true, b])
        }
        setTimeout(function () {
            Ext.removeNode(a)
        }, 100)
    }, onComplete: function (f) {
        var d = this, c = f.options, a, h, b;
        try {
            a = d.parseStatus(f.xhr.status)
        } catch (g) {
            a = {success: false, isException: false}
        }
        h = a.success;
        if (h) {
            b = d.createResponse(f);
            d.fireEvent("requestcomplete", d, b, c);
            d.onJsonResponse(b.getResponseHeader("Content-Type"), b, c)
        } else {
            if (a.isException || f.aborted || f.timedout) {
                b = d.createException(f)
            } else {
                b = d.createResponse(f)
            }
            d.fireEvent("requestexception", d, b, c);
            Ext.callback(c.failure, c.scope, [b, c]);
            Ext.MessageBox.show({
                title: Deppon.errorMessage.Box.title,
                msg: Deppon.errorMessage.Box.msg,
                buttons: Ext.MessageBox.OK,
                icon: Ext.MessageBox.ERROR
            })
        }
        Ext.callback(c.callback, c.scope, [c, h, b]);
        delete d.requests[f.id];
        return b
    }
});
Ext.override(Ext.form.action.Action, {
    createCallback: function () {
        var c = this, a, b = c.form;
        return {
            success: c.onSuccess,
            failure: c.onFailure,
            exception: c.onSuccess,
            unknownException: c.onSuccess,
            callback: c.onSuccess,
            scope: c,
            timeout: (this.timeout * 1000) || (b.timeout * 1000),
            upload: b.fileUpload ? c.onSuccess : a
        }
    }
});
Ext.override(Ext.form.Basic, {
    afterAction: function (c, e) {
        if (c.waitMsg) {
            var a = Ext.MessageBox, d = this.waitMsgTarget;
            if (d === true) {
                this.owner.el.unmask()
            } else {
                if (d) {
                    d.unmask()
                } else {
                    a.updateProgress(1);
                    a.hide()
                }
            }
        }
        if (e) {
            if (c.reset) {
                this.reset()
            }
            Ext.callback(c.success, c.scope || c, [this, c]);
            this.fireEvent("actioncomplete", this, c)
        } else {
            if (!Ext.isEmpty(c) && !Ext.isEmpty(c.response) && !Ext.isEmpty(c.response.responseText)) {
                var b = Ext.decode(c.response.responseText);
                if (!b.isException) {
                    Ext.callback(c.exception, c.scope || c, [this, c])
                } else {
                    if (b.isException) {
                        Ext.callback(c.unknownException, c.scope || c, [this, c])
                    }
                }
            } else {
                Ext.callback(c.failure, c.scope || c, [this, c])
            }
            this.fireEvent("actionfailed", this, c)
        }
    }
});
Ext.ux.Toast = function () {
    var b;

    function a(d, e, g) {
        var c;
        if (g == "error") {
            c = ['<div class="msg">', '<div class="top"><div class="title">' + d + "</div></div>", '<div class="middle"><div class="erroriconstyle"></div><div class="textpanelstyle"><p style="text-align:left">' + e + "</p></div></div>", '<div class="bottom_error"></div>', "</div>"].join("")
        } else {
            c = ['<div class="msg">', '<div class="top"><div class="title">' + d + "</div></div>", '<div class="middle"><div class="okiconstyle"></div><div class="textpanelstyle"><p style="text-align:left">' + e + "</p></div></div>", '<div class="bottom_ok"></div>', "</div>"].join("")
        }
        return c
    }

    return {
        msg: function (g, f, d, e) {
            if (!b) {
                b = Ext.DomHelper.insertFirst(document.body, {id: "msg-div"}, true)
            }
            if (Ext.isEmpty(d)) {
                d = "ok"
            }
            if (Ext.isEmpty(e)) {
                e = 4000
            }
            var c = Ext.DomHelper.append(b, {html: a(g, f, d)}, true);
            c.hide();
            c.slideIn("t").ghost("t", {delay: e, remove: true})
        }, init: function () {
        }
    }
}();
if (Deppon === undefined) {
    Ext.ns("Deppon")
}
Deppon.JsLoader = function () {
    this.load = function (d) {
        var h = this, b = document.getElementsByTagName("script"), a = b.length, g, c, f;
        for (g = 0; g < a; g++) {
            if (b[g].src && b[g].src.indexOf(d) != -1) {
                h.onSuccess();
                return
            }
        }
        c = document.createElement("script");
        c.type = "text/javascript";
        c.src = d;
        f = document.getElementsByTagName("head")[0];
        try {
            f.appendChild(c);
            c.onload = c.onreadystatechange = function () {
                if (c.readyState && c.readyState != "loaded" && c.readyState != "complete") {
                    return
                }
                c.onreadystatechange = c.onload = null;
                h.onSuccess()
            }
        } catch (j) {
            if (typeof(h.onFailure) == "function") {
                h.onFailure()
            } else {
                throw"Failed to load javaScript file dynamical!"
            }
        }
    }
};
Ext.JSON.encodeDate = function (a) {
    var b = a.getTime();
    return b
};
Ext.ns("Deppon.ux.ExcelExporter");
Deppon.ux.ExcelExporter = function (b, e, d, a) {
    if (!Ext.fly("downloadAttachFileForm")) {
        var c = document.createElement("form");
        c.id = "downloadAttachFileForm";
        c.style.display = "none";
        document.body.appendChild(c)
    }
    Ext.Ajax.request({
        url: b,
        form: Ext.fly("downloadAttachFileForm"),
        method: "POST",
        params: e,
        isUpload: true,
        success: d,
        failure: a
    })
};
function dateConvert(c, a) {
    if (!Ext.isEmpty(c)) {
        var b = new Date(c);
        return b
    } else {
        return null
    }
}
function cleanComponent(d) {
    if (typeof d == "undefined") {
        return
    }
    if (typeof d == "string") {
        d = Ext.ComponentManager.get(d);
        if (!d) {
            if (d != null) {
                var c = Ext.getDom(d);
                Ext.removeNode(c)
            }
            return
        }
    }
    var a = d.removeAll();
    for (var b = 0; b < a.length; b++) {
        if (a[b].store) {
            Ext.data.StoreManager.unregister(a[b].store)
        }
    }
    a = null;
    Ext.ComponentManager.unregister(d);
    if (d.id != null) {
        var c = Ext.getDom(d.id);
        Ext.removeNode(c)
    }
}
function mergeCells(a, j) {
    var g = document.getElementById(a.getId() + "-body").firstChild.firstChild.firstChild.getElementsByTagName("tr");
    var d = g.length;
    var b;
    var e;
    var i = function (l, k) {
        if (l.rowspan != 1) {
            b = g[l.tr].getElementsByTagName("td");
            e = b[l.td - 1];
            e.rowSpan = l.rowspan;
            e.vAlign = "middle";
            Ext.each(k, function (m) {
                b = g[m.tr].getElementsByTagName("td");
                b[m.td - 1].style.display = "none"
            })
        }
    };
    var h = {};
    var f = [];
    var c;
    Ext.each(j, function (p) {
        var l = 1;
        var r = null;
        for (var n = 1; n < d; n++) {
            b = g[n].getElementsByTagName("td");
            var m = 0;
            Ext.each(b, function (t) {
                if (t.getAttribute("class").indexOf("x-grid-cell-special") != -1) {
                    m++
                }
            });
            c = p + m;
            if (!r) {
                r = b[c - 1].innerHTML;
                h = {tr: n, td: c, rowspan: l}
            } else {
                var s = b[c - 1].innerHTML;
                var k = function () {
                    h.rowspan = h.rowspan + 1;
                    f.push({tr: n, td: c});
                    if (n == d - 1) {
                        i(h, f)
                    }
                };
                var o = function () {
                    i(h, f);
                    r = s;
                    h = {tr: n, td: c, rowspan: l};
                    f = []
                };
                if (s == r) {
                    if (p != 1) {
                        var q = b[c - 2].style.display;
                        if (q == "none") {
                            k()
                        } else {
                            o()
                        }
                    } else {
                        k()
                    }
                } else {
                    o()
                }
            }
        }
    })
}
function setFormEditAble(c, b) {
    var a = c.getForm().getFields();
    a.each(function (d) {
        d.setReadOnly(!b)
    })
}
function addTab(h, a, c, d, f) {
  var g = Ext.getCmp("mainAreaPanel"), b = Ext.getCmp("mainNav");
    tab = Ext.getCmp(h);
    if (Ext.isEmpty(b)) {
        var j = c.split(".");
        c = j[0] + "_include.";
        for (var e = 1; e < j.length; e++) {
            c = c + j[e]
        }
        GUI_Proxy.addTab(h, a, c, d, f);
        return
    }
    if (d != "" && d != null) {
        g.params = d
    }
    if (!tab) {
        g.add({
            id: h,
            title: a,
            layout: "fit",
            closable: true,
            tabConfig: {width: 180},
            cls: "autoHeight",
            bodyCls: "autoHeight",
            loader: {
                scripts: true, autoLoad: true, params: d, url: c, listeners: {
                    load: function (i, k, l, m) {
                        if (f != null) {
                            f(i.getTarget(), l.params)
                        }
                    }
                }
            }
        });
        g.setActiveTab(g.child("#" + h))
    } else {
        g.setActiveTab(tab);
        if (f != null) {
            f(tab, d)
        }
    }
}
function removeTab(c) {
    var b = Ext.getCmp("mainAreaPanel"), a = Ext.getCmp(c);
    if (b == null) {
        return
    }
    b.remove(a, true)
}
Ext.define("Deppon.errorMessage.Window", {
    extend: "Ext.window.Window",
    title: "Server Exception",
    eTitle: "Unkown Exception",
    eDetailTitle: "Exception Detailed Information",
    bodyStyle: "padding:5px 5px 0",
    resizable: false,
    modal: true,
    width: 550,
    defaults: {anchor: "100%", autoScroll: true},
    message: null,
    buttons: [{
        text: "OK", handler: function (a, b) {
            a.up("window").destroy()
        }
    }],
    constructor: function (b) {
        var c = this, a = Ext.apply({}, b);
        c.message = b.message;
        c.stackTrace = b.stackTrace;
        c.items = [{xtype: "panel", frame: true, title: c.eTitle, width: 500, html: c.message}, {
            xtype: "panel",
            frame: true,
            title: c.eDetailTitle,
            collapsible: true,
            collapsed: true,
            width: 500,
            autoScroll: true,
            items: [{height: 200, width: 500, html: c.stackTrace}]
        }];
        c.callParent([a])
    }
});
Ext.define("Deppon.errorMessage.Box", {
    statics: {
        title: "Notice:",
        msg: "Server Connection Exception",
        goLoginMsg: "Session is invalid, Please login again!",
        showGoLoginWin: function () {
            Ext.MessageBox.show({
                title: Deppon.errorMessage.Box.title,
                msg: Deppon.errorMessage.Box.goLoginMsg,
                buttons: Ext.MessageBox.OK,
                fn: function (a) {
                    window.location = "../login/index.action"
                },
                icon: Ext.MessageBox.WARNING
            })
        }
    }
});
Ext.apply(Ext.form.field.VTypes, {
    order: function (c, e) {
        e.on("keyup", function (h, g) {
            var f = h.getValue();
            f = f.replace(/[^\x00-\xff]/gi, "");
            h.setValue(f)
        }, e);
        var b = e.minCharLength || 8, a = e.maxCharLength || 10, d;
        if (b > a) {
            Ext.form.field.VTypes.orderText = "正则表达式错误！";
            return false
        }
        d = new RegExp("^[0-9]{" + b + "," + a + "}$");
        Ext.form.field.VTypes.orderText = "请输入正确的单号格式[" + b + "~" + a + "位数字]";
        return d.test(c)
    }, orderMask: /[0-9]/i
});
Ext.apply(Ext.form.field.VTypes, {
    waybill: function (c, e) {
        e.on("keyup", function (h, g) {
            var f = h.getValue();
            f = f.replace(/[^\x00-\xff]/gi, "");
            h.setValue(f)
        }, e);
        var b = e.minCharLength || 8, a = e.maxCharLength || 10, d;
        if (b > a) {
            Ext.form.field.VTypes.waybillText = "正则表达式错误！";
            return false
        }
        d = new RegExp("^[0-9]{" + b + "," + a + "}$");
        Ext.form.field.VTypes.waybillText = "请输入正确的单号格式[" + b + "~" + a + "位数字]";
        return d.test(c)
    }, waybillMask: /[0-9]/i
});
Ext.define("Deppon.selector.SingleSelector", {
    extend: "Ext.form.ComboBox",
    alias: ["widget.singleselector", "widget.dynamiccomboselector"],
    alternateClassName: ["Deppon.commonselector.DynamicComboSelector"],
    triggerCls: Ext.baseCSSPrefix + "form-search-trigger",
    listWidth: this.width,
    multiSelect: false,
    isPaging: false,
    isEnterQuery: false,
    displayField: null,
    valueField: null,
    showContent: null,
    queryParam: null,
    triggerAction: "query",
    minChars: 0,
    hideTrigger: false,
    plugins: "clearvalueplugin",
    queryAllFlag: true,
    validValueLength: 0,
    listConfig: {
        getInnerTpl: function () {
            var c = this.up("combo"), b = c.showContent, a = c.getKeyWords(b);
            if (a.length == 2) {
                return Ext.String.format('<div class="deppon-combo-item"><h3><span>{{1}}</span></h3>{{0}}</div>', a[0], a[1])
            } else {
                return this.up("combo").showContent
            }
        }
    },
    getKeyWords: function (g) {
        var f = g.split("}"), c, b = [], d;
        for (var e = 0, a = f.length; e < a; e++) {
            c = f[e];
            d = c.indexOf("{");
            if (d != -1) {
                b.push(c.substring(c.indexOf("{") + 1, c.length))
            }
        }
        return b
    },
    getValueModel: function () {
        var a = this.valueModels;
        if (Ext.isEmpty(a) && a.length > 0) {
            return a[0]
        } else {
            return null
        }
    },
    getChange: function (c, b, a) {
        if (c.isExpanded == true) {
            c.collapse()
        }
    },
    getKeyPress: function (d, c, a) {
        var b = this;
        if (c.getKey() == c.ENTER) {
            if (b.queryAllFlag) {
                b.enterQueryAction(d)
            } else {
                if (Ext.isEmpty(b.getValue())) {
                    b.setActiveErrors(["请输入查询条件!"]);
                    this.doComponentLayout()
                } else {
                    b.enterQueryAction(d)
                }
            }
        }
    },
    getBeforeLoad: function (b, a, d) {
        var c = this, f = a.params;
        if (Ext.isEmpty(f)) {
            f = {};
            Ext.apply(a, {params: f})
        }
        f[c.queryParam] = c.rawValue
    },
    initEvents: function () {
        var a = this;
        a.callParent(arguments);
        if (a.isEnterQuery == true) {
            a.mon(a, "change", a.getChange, a);
            a.mon(a, "keypress", a.getKeyPress, a)
        }
        a.mon(a.store, "beforeLoad", a.getBeforeLoad, a)
    },
    initComponent: function () {
        var a = this;
        a.on("expand", function (c, b) {
            c.getPicker().minWidth = a.listWidth;
            c.getPicker().setWidth(a.listWidth)
        });
        if (a.isPaging == true) {
            a.pageSize = a.store.pageSize
        }
        if (a.showContent == null) {
            a.showContent = "{" + a.displayField + "}"
        }
        if (a.isEnterQuery == true) {
            a.enableKeyEvents = true;
            a.queryDelay = 1000000
        }
        this.callParent(arguments)
    },
    onTriggerClick: function () {
        var a = this;
        if (a.queryAllFlag) {
            a.queryAction()
        } else {
            if (Ext.isEmpty(a.getValue())) {
                a.setActiveErrors(["请输入查询条件!"]);
                this.doComponentLayout()
            } else {
                a.queryAction()
            }
        }
    },
    enterQueryAction: function (d) {
        var a = this, c = a.getPlugin("clearvalueplugin"), b = d.getValue();
        if (d.validValueLength != 0 && (!Ext.isEmpty(b) && b.length < d.validValueLength)) {
            d.setActiveErrors(["请输入至少" + d.validValueLength + "个字符!"]);
            d.doComponentLayout();
            return
        }
        d.store.loadPage(1, {
            scope: this, callback: function (f, e, g) {
                if (f.length > 0) {
                    d.expand()
                } else {
                    e.params[d.queryParam] = "";
                    d.lastQuery = undefined
                }
            }
        });
        if (!Ext.isEmpty(c)) {
            a.hasSearch = true;
            a.triggerCell.item(0).setDisplayed(true)
        }
    },
    queryAction: function () {
        var a = this, b;
        if (!a.readOnly && !a.disabled) {
            if (a.isExpanded) {
                a.collapse()
            } else {
                a.onFocus({});
                b = a.getValue();
                if (a.validValueLength != 0 && (!Ext.isEmpty(b) && b.length < a.validValueLength)) {
                    a.setActiveErrors(["请输入至少" + a.validValueLength + "个字符!"]);
                    a.doComponentLayout();
                    return
                }
                if (a.triggerAction === "all") {
                    a.doQuery(a.allQuery, true)
                } else {
                    a.doQuery(a.getRawValue(), false, true)
                }
            }
            a.inputEl.focus()
        }
    }
});
Ext.define("Deppon.selector.LinkedSelector", {
    extend: "Deppon.selector.SingleSelector",
    alias: ["widget.linkedselector", "widget.linkagecomboselector"],
    alternateClassName: ["Deppon.commonselector.LinkageComboSelector"],
    parentParamsAndItemIds: null,
    eventType: ["callparent"],
    getFocus: function () {
        var a = this;
        a.on("focus", function () {
            a.setValue(null);
            a.store.loadPage(1, {
                scope: this, callback: function (c, b, d) {
                    if (c.length > 0) {
                        a.expand()
                    }
                }
            })
        })
    },
    getCallParent: function () {
        var b = this, a;
        if (!Ext.isEmpty(b.parentParamsAndItemIds)) {
            Ext.Object.each(b.parentParamsAndItemIds, function (d, e, c) {
                a = b.up().items.get(e);
                if (!a.hasListener("select")) {
                    a.on("select", function (f) {
                        b.setValue(null);
                        b.store.loadPage(1, {
                            scope: this, callback: function (h, g, i) {
                                b.focus(false, 100);
                                b.expand()
                            }
                        })
                    })
                }
            })
        }
    },
    initComponent: function () {
        var a = this;
        a.on("boxready", function () {
            var c = null;
            for (var b = 0; b < a.eventType.length; b++) {
                if (a.eventType[b] == "focus") {
                    a.getFocus()
                } else {
                    if (a.eventType[b] == "callparent") {
                        c = "callparent";
                        a.getCallParent()
                    }
                }
            }
            if (c == "callparent") {
                a.un("focus")
            }
        });
        this.callParent(arguments);
        a.store.on("beforeLoad", function (c, b, f) {
            var d = null, g = b.params;
            if (Ext.isEmpty(g)) {
                g = {}
            }
            g[a.queryParam] = a.rawValue;
            if (!Ext.isEmpty(a.parentParamsAndItemIds)) {
                Ext.Object.each(a.parentParamsAndItemIds, function (h, i, e) {
                    d = a.up().items.get(i);
                    g[h] = d.getValue()
                })
            }
            Ext.apply(b, {params: g})
        })
    }
});
Ext.define("Ext.ux.form.field.BoxSelect", {
    extend: "Ext.form.field.ComboBox",
    alias: ["widget.comboboxselect", "widget.boxselect"],
    requires: ["Ext.selection.Model", "Ext.data.Store"],
    multiSelect: true,
    forceSelection: true,
    createNewOnEnter: false,
    createNewOnBlur: false,
    encodeSubmitValue: false,
    triggerOnClick: true,
    stacked: false,
    pinList: true,
    filterPickList: false,
    selectOnFocus: true,
    grow: true,
    growMin: false,
    growMax: false,
    fieldSubTpl: ['<div id="{cmpId}-listWrapper" class="x-boxselect {fieldCls} {typeCls}">', '<ul id="{cmpId}-itemList" class="x-boxselect-list">', '<li id="{cmpId}-inputElCt" class="x-boxselect-input">', '<input id="{cmpId}-inputEl" type="{type}" ', '<tpl if="name">name="{name}" </tpl>', '<tpl if="value"> value="{[Ext.util.Format.htmlEncode(values.value)]}"</tpl>', '<tpl if="size">size="{size}" </tpl>', '<tpl if="tabIdx">tabIndex="{tabIdx}" </tpl>', '<tpl if="disabled"> disabled="disabled"</tpl>', 'class="x-boxselect-input-field {inputElCls}" autocomplete="off">', "</li>", "</ul>", "</div>", {
        compiled: true,
        disableFormats: true
    }],
    childEls: ["listWrapper", "itemList", "inputEl", "inputElCt"],
    componentLayout: "boxselectfield",
    initComponent: function () {
        var b = this, a = b.typeAhead;
        if (a && !b.editable) {
            Ext.Error.raise("If typeAhead is enabled the combo must be editable: true -- please change one of those settings.")
        }
        Ext.apply(b, {typeAhead: false});
        b.callParent();
        b.typeAhead = a;
        b.selectionModel = new Ext.selection.Model({
            store: b.valueStore,
            mode: "MULTI",
            lastFocused: null,
            onSelectChange: function (c, e, d, f) {
                f()
            }
        });
        if (!Ext.isEmpty(b.delimiter) && b.multiSelect) {
            b.delimiterRegexp = new RegExp(String(b.delimiter).replace(/[$%()*+.?\[\\\]{|}]/g, "\\$&"))
        }
    },
    initEvents: function () {
        var a = this;
        a.callParent(arguments);
        if (!a.enableKeyEvents) {
            a.mon(a.inputEl, "keydown", a.onKeyDown, a)
        }
        a.mon(a.inputEl, "paste", a.onPaste, a);
        a.mon(a.listWrapper, "click", a.onItemListClick, a);
        a.mon(a.selectionModel, {
            selectionchange: function (b, c) {
                a.applyMultiselectItemMarkup();
                a.fireEvent("valueselectionchange", a, c)
            }, focuschange: function (b, d, c) {
                a.fireEvent("valuefocuschange", a, d, c)
            }, scope: a
        })
    },
    onBindStore: function (a, b) {
        var c = this;
        if (a) {
            c.valueStore = new Ext.data.Store({model: a.model, proxy: {type: "memory"}});
            c.mon(c.valueStore, "datachanged", c.applyMultiselectItemMarkup, c);
            if (c.selectionModel) {
                c.selectionModel.bindStore(c.valueStore)
            }
        }
    },
    onUnbindStore: function (a) {
        var b = this, c = b.valueStore;
        if (c) {
            if (b.selectionModel) {
                b.selectionModel.setLastFocused(null);
                b.selectionModel.deselectAll();
                b.selectionModel.bindStore(null)
            }
            b.mun(c, "datachanged", b.applyMultiselectItemMarkup, b);
            c.destroy();
            b.valueStore = null
        }
        b.callParent(arguments)
    },
    createPicker: function () {
        var b = this, a = b.callParent(arguments);
        b.mon(a, {beforerefresh: b.onBeforeListRefresh, scope: b});
        if (b.filterPickList) {
            a.addCls("x-boxselect-hideselections")
        }
        return a
    },
    onDestroy: function () {
        var a = this;
        Ext.destroyMembers(a, "valueStore", "selectionModel");
        a.callParent(arguments)
    },
    getSubTplData: function () {
        var a = this, b = a.callParent(), c = a.emptyText && b.value.length < 1;
        if (c) {
            b.value = a.emptyText
        } else {
            b.value = ""
        }
        b.inputElCls = b.fieldCls.match(a.emptyCls) ? a.emptyCls : "";
        return b
    },
    afterRender: function () {
        var a = this;
        if (Ext.supports.Placeholder && a.inputEl && a.emptyText) {
            delete a.inputEl.dom.placeholder
        }
        a.bodyEl.applyStyles("vertical-align:top");
        if (a.grow) {
            if (Ext.isNumber(a.growMin) && (a.growMin > 0)) {
                a.listWrapper.applyStyles("min-height:" + a.growMin + "px")
            }
            if (Ext.isNumber(a.growMax) && (a.growMax > 0)) {
                a.listWrapper.applyStyles("max-height:" + a.growMax + "px")
            }
        }
        if (a.stacked === true) {
            a.itemList.addCls("x-boxselect-stacked")
        }
        if (!a.multiSelect) {
            a.itemList.addCls("x-boxselect-singleselect")
        }
        a.applyMultiselectItemMarkup();
        a.callParent(arguments)
    },
    findRecord: function (d, c) {
        var b = this.store, a;
        if (!b) {
            return false
        }
        a = b.queryBy(function (e, f) {
            return e.isEqual(e.get(d), c)
        });
        return (a.getCount() > 0) ? a.first() : false
    },
    onLoad: function () {
        var b = this, a = b.valueField, c = b.valueStore, d = false;
        if (c) {
            if (!Ext.isEmpty(b.value) && (c.getCount() == 0)) {
                b.setValue(b.value, false, true)
            }
            c.suspendEvents();
            c.each(function (g) {
                var f = b.findRecord(a, g.get(a)), e = f ? c.indexOf(g) : -1;
                if (e >= 0) {
                    c.removeAt(e);
                    c.insert(e, f);
                    d = true
                }
            });
            c.resumeEvents();
            if (d) {
                c.fireEvent("datachanged", c)
            }
        }
        b.callParent(arguments)
    },
    isFilteredRecord: function (a) {
        var f = this, b = f.store, d = f.valueField, e, c = false;
        e = b.findExact(d, a.get(d));
        c = ((e === -1) && (!b.snapshot || (f.findRecord(d, a.get(d)) !== false)));
        c = c || (!c && (e === -1) && (f.forceSelection !== true) && (f.valueStore.findExact(d, a.get(d)) >= 0));
        return c
    },
    doRawQuery: function () {
        var a = this, b = a.inputEl.dom.value;
        if (a.multiSelect) {
            b = b.split(a.delimiter).pop()
        }
        this.doQuery(b, false, true)
    },
    onBeforeListRefresh: function () {
        this.ignoreSelection++
    },
    onListRefresh: function () {
        this.callParent(arguments);
        if (this.ignoreSelection > 0) {
            --this.ignoreSelection
        }
    },
    onListSelectionChange: function (c, f) {
        var b = this, d = b.valueStore, e = [], a;
        if ((b.ignoreSelection <= 0) && b.isExpanded) {
            d.each(function (g) {
                if (Ext.Array.contains(f, g) || b.isFilteredRecord(g)) {
                    e.push(g)
                }
            });
            e = Ext.Array.merge(e, f);
            a = Ext.Array.intersect(e, d.getRange()).length;
            if ((a != e.length) || (a != b.valueStore.getCount())) {
                b.setValue(e, false);
                if (!b.multiSelect || !b.pinList) {
                    Ext.defer(b.collapse, 1, b)
                }
                if (d.getCount() > 0) {
                    b.fireEvent("select", b, d.getRange())
                }
            }
            b.inputEl.focus();
            if (!b.pinList) {
                b.inputEl.dom.value = ""
            }
            if (b.selectOnFocus) {
                b.inputEl.dom.select()
            }
        }
    },
    syncSelection: function () {
        var f = this, d = f.picker, c = f.valueField, a, e, b;
        if (d) {
            a = d.store;
            e = [];
            if (f.valueStore) {
                f.valueStore.each(function (h) {
                    var g = a.findExact(c, h.get(c));
                    if (g >= 0) {
                        e.push(a.getAt(g))
                    }
                })
            }
            f.ignoreSelection++;
            b = d.getSelectionModel();
            b.deselectAll();
            if (e.length > 0) {
                b.select(e)
            }
            if (f.ignoreSelection > 0) {
                --f.ignoreSelection
            }
        }
    },
    doAlign: function () {
        var d = this, c = d.picker, a = "-above", b;
        d.picker.alignTo(d.listWrapper, d.pickerAlign, d.pickerOffset);
        b = c.el.getY() < d.inputEl.getY();
        d.bodyEl[b ? "addCls" : "removeCls"](d.openCls + a);
        c[b ? "addCls" : "removeCls"](c.baseCls + a)
    },
    alignPicker: function () {
        var c = this, b = c.picker, a = b.getTargetEl().dom.scrollTop;
        c.callParent(arguments);
        if (c.isExpanded) {
            if (c.matchFieldWidth) {
                b.setWidth(c.listWrapper.getWidth())
            }
            b.getTargetEl().dom.scrollTop = a
        }
    },
    getCursorPosition: function () {
        var a;
        if (Ext.isIE) {
            a = document.selection.createRange();
            a.collapse(true);
            a.moveStart("character", -this.inputEl.dom.value.length);
            a = a.text.length
        } else {
            a = this.inputEl.dom.selectionStart
        }
        return a
    },
    hasSelectedText: function () {
        var b, a;
        if (Ext.isIE) {
            b = document.selection;
            a = b.createRange();
            return (a.parentElement() == this.inputEl.dom)
        } else {
            return this.inputEl.dom.selectionStart != this.inputEl.dom.selectionEnd
        }
    },
    onKeyDown: function (d, i) {
        var f = this, h = d.getKey(), b = f.inputEl.dom.value, j = f.valueStore, c = f.selectionModel, a = false;
        if (f.readOnly || f.disabled || !f.editable) {
            return
        }
        if (f.isExpanded && (h == d.A && d.ctrlKey)) {
            f.select(f.getStore().getRange());
            c.setLastFocused(null);
            c.deselectAll();
            f.collapse();
            f.inputEl.focus();
            a = true
        } else {
            if ((j.getCount() > 0) && ((b == "") || ((f.getCursorPosition() === 0) && !f.hasSelectedText()))) {
                var g = (c.getCount() > 0) ? j.indexOf(c.getLastSelected() || c.getLastFocused()) : -1;
                if ((h == d.BACKSPACE) || (h == d.DELETE)) {
                    if (g > -1) {
                        if (c.getCount() > 1) {
                            g = -1
                        }
                        f.valueStore.remove(c.getSelection())
                    } else {
                        f.valueStore.remove(f.valueStore.last())
                    }
                    c.clearSelections();
                    f.setValue(f.valueStore.getRange());
                    if (g > 0) {
                        c.select(g - 1)
                    }
                    a = true
                } else {
                    if ((h == d.RIGHT) || (h == d.LEFT)) {
                        if ((g == -1) && (h == d.LEFT)) {
                            c.select(j.last());
                            a = true
                        } else {
                            if (g > -1) {
                                if (h == d.RIGHT) {
                                    if (g < (j.getCount() - 1)) {
                                        c.select(g + 1, d.shiftKey);
                                        a = true
                                    } else {
                                        if (!d.shiftKey) {
                                            c.setLastFocused(null);
                                            c.deselectAll();
                                            a = true
                                        }
                                    }
                                } else {
                                    if ((h == d.LEFT) && (g > 0)) {
                                        c.select(g - 1, d.shiftKey);
                                        a = true
                                    }
                                }
                            }
                        }
                    } else {
                        if (h == d.A && d.ctrlKey) {
                            c.selectAll();
                            a = d.A
                        }
                    }
                }
                f.inputEl.focus()
            }
        }
        if (a) {
            f.preventKeyUpEvent = a;
            d.stopEvent();
            return
        }
        if (f.isExpanded && (h == d.ENTER) && f.picker.highlightedItem) {
            f.preventKeyUpEvent = true
        }
        if (f.enableKeyEvents) {
            f.callParent(arguments)
        }
        if (!d.isSpecialKey() && !d.hasModifier()) {
            f.selectionModel.setLastFocused(null);
            f.selectionModel.deselectAll();
            f.inputEl.focus()
        }
    },
    onKeyUp: function (d, a) {
        var b = this, c = b.inputEl.dom.value;
        if (b.preventKeyUpEvent) {
            d.stopEvent();
            if ((b.preventKeyUpEvent === true) || (d.getKey() === b.preventKeyUpEvent)) {
                delete b.preventKeyUpEvent
            }
            return
        }
        if (b.multiSelect && (b.delimiterRegexp && b.delimiterRegexp.test(c)) || ((b.createNewOnEnter === true) && d.getKey() == d.ENTER)) {
            c = Ext.Array.clean(c.split(b.delimiterRegexp));
            b.inputEl.dom.value = "";
            b.setValue(b.valueStore.getRange().concat(c));
            b.inputEl.focus()
        }
        b.callParent([d, a])
    },
    onPaste: function (f, a) {
        var b = this, d = b.inputEl.dom.value, c = (f && f.browserEvent && f.browserEvent.clipboardData) ? f.browserEvent.clipboardData : false;
        if (b.multiSelect && (b.delimiterRegexp && b.delimiterRegexp.test(d))) {
            if (c && c.getData) {
                if (/text\/plain/.test(c.types)) {
                    d = c.getData("text/plain")
                } else {
                    if (/text\/html/.test(c.types)) {
                        d = c.getData("text/html")
                    }
                }
            }
            d = Ext.Array.clean(d.split(b.delimiterRegexp));
            b.inputEl.dom.value = "";
            b.setValue(b.valueStore.getRange().concat(d));
            b.inputEl.focus()
        }
    },
    onExpand: function () {
        var b = this, a = b.listKeyNav;
        b.callParent(arguments);
        if (a || !b.filterPickList) {
            return
        }
        a = b.listKeyNav;
        a.highlightAt = function (e) {
            var d = this.boundList, f = d.all.item(e), c = d.all.getCount(), g;
            if (f && f.hasCls("x-boundlist-selected")) {
                if ((e == 0) || !d.highlightedItem || (d.indexOf(d.highlightedItem) < e)) {
                    g = 1
                } else {
                    g = -1
                }
                do {
                    e = e + g;
                    f = d.all.item(e)
                } while ((e > 0) && (e < c) && f.hasCls("x-boundlist-selected"));
                if (f.hasCls("x-boundlist-selected")) {
                    return
                }
            }
            if (f) {
                f = f.dom;
                d.highlightItem(f);
                d.getTargetEl().scrollChildIntoView(f, false)
            }
        }
    },
    onTypeAhead: function () {
        var f = this, e = f.displayField, h = f.inputEl.dom, j = f.valueStore, i = f.getPicker(), c, a, d, b;
        if (f.filterPickList) {
            var g = this.createFilterFn(e, h.value);
            c = f.store.findBy(function (k) {
                return ((j.indexOfId(k.getId()) === -1) && g(k))
            });
            c = (c === -1) ? false : f.store.getAt(c)
        } else {
            c = f.store.findRecord(e, h.value)
        }
        if (c) {
            a = c.get(e);
            d = a.length;
            b = h.value.length;
            i.highlightItem(i.getNode(c));
            if (b !== 0 && b !== d) {
                h.value = a;
                f.selectText(b, a.length)
            }
        }
    },
    onItemListClick: function (a, c, e) {
        var d = this, b = a.getTarget(".deppon-boxselect-item"), f = b ? a.getTarget(".deppon-boxselect-item-close") : false;
        if (d.readOnly || d.disabled) {
            return
        }
        a.stopPropagation();
        if (b) {
            if (f) {
                d.removeByListItemNode(b);
                if (d.valueStore.getCount() > 0) {
                    d.fireEvent("select", d, d.valueStore.getRange())
                }
            } else {
                d.toggleSelectionByListItemNode(b, a.shiftKey)
            }
            d.inputEl.focus()
        } else {
            if (d.selectionModel.getCount() > 0) {
                d.selectionModel.setLastFocused(null);
                d.selectionModel.deselectAll()
            }
            if (d.triggerOnClick) {
                d.onTriggerClick()
            }
        }
    },
    getMultiSelectItemMarkup: function () {
        var a = this;
        if (!a.multiSelectItemTpl) {
            if (!a.labelTpl) {
                a.labelTpl = Ext.create("Ext.XTemplate", "{[values." + a.displayField + "]}")
            } else {
                if (Ext.isString(a.labelTpl) || Ext.isArray(a.labelTpl)) {
                    a.labelTpl = Ext.create("Ext.XTemplate", a.labelTpl)
                }
            }
            a.multiSelectItemTpl = ['<tpl for=".">', '<li class="deppon-boxselect-item ', '<tpl if="this.isSelected(values.' + a.valueField + ')">', " selected", "</tpl>", '" qtip="{[typeof values === "string" ? values : values.' + a.displayField + ']}">', '<div class="deppon-boxselect-item-text">{[typeof values === "string" ? values : this.getItemLabel(values)]}</div>', '<div class="deppon-tab-close-btn  deppon-boxselect-item-close"></div>', "</li>", "</tpl>", {
                compile: true,
                disableFormats: true,
                isSelected: function (c) {
                    var b = a.valueStore.findExact(a.valueField, c);
                    if (b >= 0) {
                        return a.selectionModel.isSelected(a.valueStore.getAt(b))
                    }
                    return false
                },
                getItemLabel: function (b) {
                    return a.getTpl("labelTpl").apply(b)
                }
            }]
        }
        return this.getTpl("multiSelectItemTpl").apply(Ext.Array.pluck(this.valueStore.getRange(), "data"))
    },
    applyMultiselectItemMarkup: function () {
        var c = this, a = c.itemList, b;
        if (a) {
            while ((b = c.inputElCt.prev()) != null) {
                b.remove()
            }
            c.inputElCt.insertHtml("beforeBegin", c.getMultiSelectItemMarkup())
        }
        Ext.Function.defer(function () {
            if (c.picker && c.isExpanded) {
                c.alignPicker()
            }
            if (c.hasFocus) {
                c.inputElCt.scrollIntoView(c.listWrapper)
            }
        }, 15)
    },
    getRecordByListItemNode: function (b) {
        var d = this, c = 0, a = d.itemList.dom.firstChild;
        while (a && a.nextSibling) {
            if (a == b) {
                break
            }
            c++;
            a = a.nextSibling
        }
        c = (a == b) ? c : false;
        if (c === false) {
            return false
        }
        return d.valueStore.getAt(c)
    },
    toggleSelectionByListItemNode: function (b, d) {
        var c = this, e = c.getRecordByListItemNode(b), a = c.selectionModel;
        if (e) {
            if (a.isSelected(e)) {
                if (a.isFocused(e)) {
                    a.setLastFocused(null)
                }
                a.deselect(e)
            } else {
                a.select(e, d)
            }
        }
    },
    removeByListItemNode: function (a) {
        var b = this, c = b.getRecordByListItemNode(a);
        if (c) {
            b.valueStore.remove(c);
            b.setValue(b.valueStore.getRange())
        }
    },
    getRawValue: function () {
        var b = this, c = b.inputEl, a;
        b.inputEl = false;
        a = b.callParent(arguments);
        b.inputEl = c;
        return a
    },
    setRawValue: function (c) {
        var b = this, d = b.inputEl, a;
        b.inputEl = false;
        a = b.callParent([c]);
        b.inputEl = d;
        return a
    },
    addValue: function (b) {
        var a = this;
        if (b) {
            a.setValue(Ext.Array.merge(a.value, Ext.Array.from(b)))
        }
    },
    removeValue: function (b) {
        var a = this;
        if (b) {
            a.setValue(Ext.Array.difference(a.value, Ext.Array.from(b)))
        }
    },
    setValue: function (l, b, m) {
        var k = this, o = k.valueStore, n = k.valueField, f, g, d, a, e, j = [];
        if (Ext.isEmpty(l)) {
            l = null
        }
        if (Ext.isString(l) && k.multiSelect) {
            l = l.split(k.delimiter)
        }
        l = Ext.Array.from(l, true);
        for (d = 0, g = l.length; d < g; d++) {
            f = l[d];
            if (!f || !f.isModel) {
                a = o.findExact(n, f);
                if (a >= 0) {
                    l[d] = o.getAt(a)
                } else {
                    a = k.findRecord(n, f);
                    if (!a) {
                        if (k.forceSelection) {
                            j.push(f)
                        } else {
                            a = {};
                            a[k.valueField] = f;
                            a[k.displayField] = f;
                            a = new k.valueStore.model(a)
                        }
                    }
                    if (a) {
                        l[d] = a
                    }
                }
            }
        }
        if ((m !== true) && (j.length > 0) && (k.queryMode === "remote")) {
            var c = {};
            c[k.valueField] = j.join(k.delimiter);
            k.store.loadPage(1, {
                params: c, callback: function () {
                    if (k.itemList) {
                        k.itemList.unmask()
                    }
                    k.setValue(l, b, true);
                    k.autoSize()
                }
            });
            return false
        }
        if (!k.multiSelect && (l.length > 0)) {
            for (d = l.length - 1; d >= 0; d--) {
                if (l[d].isModel) {
                    l = l[d];
                    break
                }
            }
            if (Ext.isArray(l)) {
                l = l[l.length - 1]
            }
        }
        return k.callParent([l, b])
    },
    getValueRecords: function () {
        return this.valueStore.getRange()
    },
    getSubmitData: function () {
        var a = this, b = a.callParent(arguments);
        if (a.multiSelect && a.encodeSubmitValue && b && b[a.name]) {
            b[a.name] = Ext.encode(b[a.name])
        }
        return b
    },
    mimicBlur: function () {
        var a = this;
        if (a.selectOnTab && a.picker && a.picker.highlightedItem) {
            a.inputEl.dom.value = ""
        }
        a.callParent(arguments)
    },
    assertValue: function () {
        var a = this, c = a.inputEl.dom.value, d = !Ext.isEmpty(c) ? a.findRecordByDisplay(c) : false, b = false;
        if (!d && !a.forceSelection && a.createNewOnBlur && !Ext.isEmpty(c)) {
            b = c
        } else {
            if (d) {
                b = d
            }
        }
        if (b) {
            a.addValue(b)
        }
        a.inputEl.dom.value = "";
        a.collapse()
    },
    checkChange: function () {
        if (!this.suspendCheckChange && !this.isDestroyed) {
            var c = this, f = c.valueStore, b = c.lastValue, a = c.valueField, e = Ext.Array.map(Ext.Array.from(c.value), function (g) {
                if (g.isModel) {
                    return g.get(a)
                }
                return g
            }, this).join(this.delimiter), d = c.isEqual(e, b);
            if (!d || ((e.length > 0 && f.getCount() < e.length))) {
                f.suspendEvents();
                f.removeAll();
                if (Ext.isArray(c.valueModels)) {
                    f.add(c.valueModels)
                }
                f.resumeEvents();
                f.fireEvent("datachanged", f);
                if (!d) {
                    c.lastValue = e;
                    c.fireEvent("change", c, e, b);
                    c.onChange(e, b)
                }
            }
        }
    },
    isEqual: function (h, g) {
        var b = Ext.Array.from, c = this.valueField, d, a, f, e;
        h = b(h);
        g = b(g);
        a = h.length;
        if (a !== g.length) {
            return false
        }
        for (d = 0; d < a; d++) {
            f = h[d].isModel ? h[d].get(c) : h[d];
            e = g[d].isModel ? g[d].get(c) : g[d];
            if (f !== e) {
                return false
            }
        }
        return true
    },
    applyEmptyText: function () {
        var b = this, a = b.emptyText, c, d;
        if (b.rendered && a) {
            d = Ext.isEmpty(b.value) && !b.hasFocus;
            c = b.inputEl;
            if (d) {
                c.dom.value = a;
                c.addCls(b.emptyCls);
                b.listWrapper.addCls(b.emptyCls)
            } else {
                if (c.dom.value === a) {
                    c.dom.value = ""
                }
                b.listWrapper.removeCls(b.emptyCls);
                c.removeCls(b.emptyCls)
            }
            b.autoSize()
        }
    },
    preFocus: function () {
        var b = this, c = b.inputEl, a = b.emptyText, d;
        if (a && c.dom.value === a) {
            c.dom.value = "";
            d = true;
            c.removeCls(b.emptyCls);
            b.listWrapper.removeCls(b.emptyCls)
        }
        if (b.selectOnFocus || d) {
            c.dom.select()
        }
    },
    onFocus: function () {
        var c = this, b = c.focusCls, a = c.itemList;
        if (b && a) {
            a.addCls(b)
        }
        c.callParent(arguments)
    },
    onBlur: function () {
        var c = this, b = c.focusCls, a = c.itemList;
        if (b && a) {
            a.removeCls(b)
        }
        c.callParent(arguments)
    },
    renderActiveError: function () {
        var d = this, c = d.invalidCls, b = d.itemList, a = d.hasActiveError();
        if (c && b) {
            b[a ? "addCls" : "removeCls"](d.invalidCls + "-field")
        }
        d.callParent(arguments)
    },
    autoSize: function () {
        var b = this, a;
        if (b.grow && b.rendered) {
            b.autoSizing = true;
            b.updateLayout()
        }
        return b
    },
    afterComponentLayout: function () {
        var b = this, a;
        if (b.autoSizing) {
            height = b.getHeight();
            if (height !== b.lastInputHeight) {
                if (b.isExpanded) {
                    b.alignPicker()
                }
                b.fireEvent("autosize", b, height);
                b.lastInputHeight = height;
                delete b.autoSizing
            }
        }
    }
});
Ext.define("Ext.ux.layout.component.field.BoxSelectField", {
    alias: ["layout.boxselectfield"],
    extend: "Ext.layout.component.field.Trigger",
    type: "boxselectfield",
    waitForOuterWidthInDom: true,
    beginLayout: function (c) {
        var b = this, a = b.owner;
        b.callParent(arguments);
        c.inputElCtContext = c.getEl("inputElCt");
        a.inputElCt.setStyle("width", "");
        b.skipInputGrowth = !a.grow || !a.multiSelect
    },
    beginLayoutFixed: function (d, b, e) {
        var c = this, a = d.target;
        a.triggerEl.setStyle("height", "24px");
        c.callParent(arguments);
        if (d.heightModel.fixed && d.lastBox) {
            a.listWrapper.setStyle("height", d.lastBox.height + "px");
            a.itemList.setStyle("height", "100%")
        }
    },
    publishInnerWidth: function (e) {
        var d = this, a = d.owner, c = a.itemList.getWidth(true) - 10, b = a.inputElCt.prev(null, true);
        if (b && !a.stacked) {
            b = Ext.fly(b);
            c = c - b.getOffsetsTo(b.up(""))[0] - b.getWidth()
        }
        if (!d.skipInputGrowth && (c < 35)) {
            c = c - 10
        } else {
            if (c < 1) {
                c = 1
            }
        }
        e.inputElCtContext.setWidth(c)
    }
});
Ext.define("Deppon.selector.MultipleSelector", {
    extend: "Ext.ux.form.field.BoxSelect",
    alias: ["widget.multipleselector", "widget.dynamicmulticomboselector"],
    alternateClassName: ["Deppon.commonselector.DynamicMultiSelectComboSelector"],
    triggerCls: Ext.baseCSSPrefix + "form-search-trigger",
    listWidth: this.width,
    isPaging: false,
    isEnterQuery: false,
    triggerOnClick: false,
    minChars: 1,
    listConfig: {
        getInnerTpl: function () {
            return this.up("combo").showContent
        }
    },
    onSpecialkey: function (f, d, b) {
        var c = this, a = d.getKey();
        if (a == d.ENTER) {
            c.doRawQuery()
        }
    },
    initEvents: function () {
        var a = this;
        a.callParent(arguments);
        if (a.enableKeyEvents && a.isEnterQuery) {
            a.mon(a, "specialkey", a.onSpecialkey, a)
        }
    },
    initComponent: function () {
        var a = this;
        a.on("expand", function (c, b) {
            c.getPicker().minWidth = a.listWidth;
            c.getPicker().setWidth(a.listWidth)
        });
        if (a.isPaging) {
            a.pageSize = a.store.pageSize
        }
        if (a.isEnterQuery) {
            a.enableKeyEvents = true;
            a.queryDelay = 1000000
        }
        if (a.showContent == null) {
            a.showContent = "{" + a.displayField + "}"
        }
        this.callParent(arguments)
    }
});
Ext.define("Deppon.selector.LinkageContainer", {
    extend: "Ext.form.FieldContainer",
    alias: "widget.linkagecontainer",
    alternateClassName: ["Deppon.commonselector.LinkageContainer"],
    defaultType: "linkedselector",
    getItemValue: function (c) {
        var b = this, a = b.items.get(c);
        if (a != null) {
            return a.getValue()
        }
        return null
    },
    getValue: function () {
        var c = this, a = new Array();
        for (var b = 0; b < c.items.length; b++) {
            a[b] = c.getItemValue(c.items.items[b].itemId)
        }
        return a
    }
});
Ext.define("Deppon.ux.ButtonDisabledPlugin", {
    alias: ["plugin.buttonlimitingplugin", "plugin.buttondisabledplugin"],
    alternateClassName: "Deppon.ux.ButtonLimitingPlugin",
    seconds: 2,
    constructor: function (a) {
        Ext.apply(this, a)
    },
    init: function (a) {
        var b = this;
        b.button = a;
        b.getDelayedTask();
        a.on("click", b.onClickButton, b)
    },
    onClickButton: function () {
        var b = this, a = b.button;
        a.setDisabled(true);
        b.task.delay(b.seconds * 1000);
        return true
    },
    setButtonDisabled: function (b) {
        var c = this, a = c.button;
        b = b || false;
        a.setDisabled(b);
        return a
    },
    getDelayedTask: function () {
        var a = this;
        if (!a.task) {
            a.task = new Ext.util.DelayedTask(a.setButtonDisabled, a)
        }
        return a.task
    },
    destory: function () {
        var b = this, a = b.button;
        Ext.destroy(b.task);
        delete b.button;
        delete b.task
    }
});
Ext.define("Deppon.grid.column.CheckColumn", {
    extend: "Ext.grid.column.Column",
    alias: "widget.checkcolumn",
    stopSelection: true,
    tdCls: Ext.baseCSSPrefix + "grid-cell-checkcolumn",
    constructor: function () {
        this.addEvents("beforecheckchange", "checkchange");
        this.callParent(arguments)
    },
    processEvent: function (g, i, m, b, h, d) {
        var f = this, l = g === "keydown" && d.getKey(), a = g == "mousedown";
        if (a || (l == d.ENTER || l == d.SPACE)) {
            var c = i.panel.store.getAt(b), j = f.dataIndex, k = !c.get(j);
            if (f.fireEvent("beforecheckchange", f, b, k) !== false) {
                c.set(j, k);
                f.fireEvent("checkchange", f, b, k);
                if (a) {
                    d.stopEvent()
                }
                if (!f.stopSelection) {
                    i.selModel.selectByPosition({row: b, column: h})
                }
                return false
            } else {
                return !f.stopSelection
            }
        } else {
            return f.callParent(arguments)
        }
    },
    renderer: function (b) {
        var c = Ext.baseCSSPrefix, a = [c + "grid-checkheader"];
        if (b) {
            a.push(c + "grid-checkheader-checked")
        }
        return '<div class="' + a.join(" ") + '">&#160;</div>'
    }
});
Ext.define("Deppon.ux.ClearValuePlugin", {
    alias: "plugin.clearvalueplugin",
    trigger1Cls: Ext.baseCSSPrefix + "form-clear-trigger",
    trigger2Cls: Ext.baseCSSPrefix + "form-search-trigger",
    constructor: function (a) {
        Ext.apply(this, a)
    },
    init: function (b) {
        var a = this;
        a.pluginId = "clearvalueplugin";
        b.hasSearch = false;
        b.trigger1Cls = a.trigger1Cls;
        b.trigger2Cls = a.trigger2Cls;
        b.onTrigger1Click = a.onTrigger1Click;
        b.onTrigger2Click = a.onTrigger2Click;
        b.on("afterrender", a.afterRender, b)
    },
    afterRender: function () {
        this.triggerCell.item(0).setDisplayed(false)
    },
    onTrigger1Click: function () {
        var a = this;
        if (a.hasSearch) {
            a.setValue("");
            a.hasSearch = false;
            a.triggerCell.item(0).setDisplayed(false);
            a.updateLayout()
        }
    },
    onTrigger2Click: function () {
        var a = this;
        a.onTriggerClick();
        a.hasSearch = true;
        a.triggerCell.item(0).setDisplayed(true)
    }
});
Ext.define("Deppon.button.ComboButton", {
    extend: "Ext.container.Container",
    alias: "widget.comboButton",
    layout: "hbox",
    arrow: null,
    button: null,
    menuWidth: function (a, c, d, e) {
        if (a.width) {
            return a.width
        } else {
            if (e) {
                return e
            } else {
                if (c) {
                    c = c.replace(/[A-Za-z]+/g, "");
                    var b = c.split(" ");
                    return (d.length * 7) + parseInt(b[1]) + parseInt(b[3]) + 14
                } else {
                    return (d.length * 7) + 24
                }
            }
        }
    },
    createArrow: function (a) {
        if (!Ext.isEmpty(this.arrow)) {
            return false
        } else {
            var b = {};
            b.items = a.menu;
            b.maxWidth = this.menuWidth(a.menu, a.padding, a.text, a.width);
            this.arrow = Ext.create("Ext.Button", {
                cls: a.cls,
                menuAlign: "tr-br",
                padding: "0 0 0 0",
                margin: "0 0 0 0",
                width: 5,
                menu: b
            });
            return true
        }
    },
    createButton: function (a) {
        if (this.button) {
            return this.button
        } else {
            if (a.width) {
                a.width = a.width - 14
            }
            a.margin = "0 0 0 0";
            this.button = Ext.create("Ext.Button", a);
            return true
        }
    },
    constructor: function (b) {
        var a = b;
        delete a.margin;
        this.config = this.config || {};
        Ext.apply(this, this.config);
        a.menuAlign = "tl-tl";
        this.createArrow(a);
        this.arrow.addClass("dp-arrow-button");
        this.arrow.menu.addClass("dp-comboButton-menu");
        delete a.menu;
        this.createButton(a);
        delete b.padding;
        this.items = [this.button, this.arrow];
        this.callParent(arguments);
        this.initConfig(b)
    }
});
Ext.define("Deppon.form.field.DateTimeField", {
    extend: "Ext.form.field.Trigger",
    alias: ["widget.my97datetimefield", "widget.datetimefield_date97"],
    time: true,
    dateConfig: [],
    initTime: "12",
    initTimeFormat: "H",
    minText: "The date in this field must be equal to or after {0}",
    maxText: "The date in this field must be equal to or before {0}",
    triggerCls: Ext.baseCSSPrefix + "form-date-trigger",
    initComponent: function () {
        var a = this;
        a.callParent(arguments);
        this.initDateConfig()
    },
    onTriggerClick: function (f) {
        var c = this;
        if (c.disabled || c.readOnly) {
            return
        }
        c.onFocus({});
        var b = document.body.clientWidth, d = document.body.clientWidth - f.getX() - c.width, g = document.body.clientHeight - f.getY() - c.height, a = 0, h = 0;
        if (d > 0) {
            a = f.getX()
        } else {
            a = document.body.clientWidth - this.width - 4
        }
        if (g > 0) {
            h = f.getY()
        } else {
            h = document.body.clientHeight - this.height - 4
        }
        WdatePicker(c.dateConfig)
    },
    initDateConfig: function () {
        var a = this;
        if (!a.dateConfig.el) {
            a.dateConfig.el = a.id
        }
        if (a.time) {
            a.addDateConfig("dateFmt", "yyyy-MM-dd HH:mm:ss")
        } else {
            if (!a.dateConfig.dateFmt) {
                a.dateConfig.dateFmt = "yyyy-MM-dd"
            }
        }
        if (!a.dateConfig.skin) {
            a.dateConfig.skin = "ext"
        }
    },
    setDateConfig: function (a) {
        this.dateConfig = a;
        this.initDateConfig()
    },
    addDateConfig: function (a, b) {
        this.removeDateConfig(a);
        this.dateConfig[a] = b
    },
    removeDateConfig: function (d) {
        var f = this, c = f.dateConfig, a = c.length;
        for (var e = 0; e < a; e++) {
            var b = c[e];
            if (b && b.split(":")[0] == d) {
                c.pop(e);
                return
            }
        }
    },
    safeParse: function (f, g) {
        var e = this, c = Ext.Date, a = null, b = e.useStrict, d;
        if (c.formatContainsHourInfo(g)) {
            a = c.parse(f, g, b)
        } else {
            d = c.parse(f + " " + e.initTime, g + " " + e.initTimeFormat, b);
            if (d) {
                a = c.clearTime(d)
            }
        }
        return a
    },
    parseDate: function (e) {
        if (!e || Ext.isDate(e)) {
            return e
        }
        var d = this, g = d.safeParse(e, d.format), b = d.altFormats, f = d.altFormatsArray, c = 0, a;
        if (!g && b) {
            f = f || b.split("|");
            a = f.length;
            for (; c < a && !g; ++c) {
                g = d.safeParse(e, f[c])
            }
        }
        return g
    },
    formatDate: function (a, b) {
        return Ext.isDate(a) ? Ext.Date.dateFormat(a, b) : a
    },
    getErrors: function (l) {
        var e = this, j = e.callParent(arguments), k = Ext.String.format, l, a, c, f = Ext.Date.clearTime, h = e.dateConfig.minDate, d = e.dateConfig.maxDate, b, m, g;
        if (l === null || l.length < 1) {
            return j
        }
        var i = WdatePicker;
        e.format = e.dateConfig.dateFmt;
        if (!Ext.isEmpty(e.format, true)) {
            if (e.format == "yyyy-MM-dd HH:mm:ss") {
                e.format = "Y-m-d H:i:s"
            } else {
                if (e.format == "yyyy-MM-dd") {
                    e.format = "Y-m-d"
                }
            }
            a = l;
            l = e.parseDate(l);
            if (!l) {
                j.push(k(e.invalidText, a, Ext.Date.unescapeFormat(e.format)));
                return j
            }
        }
        if (h && d) {
            c = l.getTime();
            if (h.length > d.length) {
                m = d.substring(d.indexOf("'") + 1, d.indexOf(")") - 1);
                g = h.substring(h.indexOf(":") + 1, h.indexOf(")") - 1);
                if (m && g) {
                    b = Ext.get(m).dom.value;
                    if (b) {
                        d = Ext.Date.parse(b, e.format);
                        h = Ext.Date.add(Ext.Date.parse(b, e.format), Ext.Date.DAY, Number(g));
                        if (h && c < h.getTime()) {
                            j.push(k(e.minText, e.formatDate(h, e.format)))
                        }
                        if (d && c > d.getTime()) {
                            j.push(k(e.maxText, e.formatDate(d, e.format)))
                        }
                    }
                }
            } else {
                m = h.substring(h.indexOf("'") + 1, h.indexOf(")") - 1);
                g = d.substring(d.indexOf(":") + 1, d.indexOf(")") - 1);
                if (m && g) {
                    b = Ext.get(m).dom.value;
                    if (b) {
                        h = Ext.Date.parse(b, e.format);
                        d = Ext.Date.add(Ext.Date.parse(b, e.format), Ext.Date.DAY, Number(g));
                        if (h && c < h.getTime()) {
                            j.push(k(e.minText, e.formatDate(h, e.format)))
                        }
                        if (d && c > d.getTime()) {
                            j.push(k(e.maxText, e.formatDate(d, e.format)))
                        }
                    }
                }
            }
        }
        return j
    }
});
Ext.define("Deppon.grid.column.Ellipsis", {
    extend: "Ext.grid.column.Column",
    alias: "widget.ellipsiscolumn",
    alternateClassName: ["Deppon.grid.EllipsisColumn"],
    initComponent: function () {
        var b = this, a = b.renderer;
        if (a) {
            b.renderer = function (g, e, c, h, f, d) {
                g = a(g, e, c, h, f, d);
                g = b.defaultRenderer(g, e, c, h, f, d);
                return g
            }
        }
        b.callParent(arguments)
    },
    defaultRenderer: function (g, d, b, h, e, c) {
        var f = this, a = b.get(f.dataIndex);
        d.tdAttr = 'data-qtip="' + a + '"';
        return g
    }
});
Ext.ns("Ext.ux.Utils");
Ext.ux.Utils.EventQueue = function (b, a) {
    if (!b) {
        throw"Handler is required."
    }
    this.handler = b;
    this.scope = a || window;
    this.queue = [];
    this.is_processing = false;
    this.postEvent = function (c, d) {
        d = d || null;
        this.queue.push({event: c, data: d});
        if (!this.is_processing) {
            this.process()
        }
    };
    this.flushEventQueue = function () {
        this.queue = []
    };
    this.process = function () {
        while (this.queue.length > 0) {
            this.is_processing = true;
            var c = this.queue.shift();
            this.handler.call(this.scope, c.event, c.data)
        }
        this.is_processing = false
    }
};
Ext.ux.Utils.FSA = function (c, b, a) {
    this.current_state = c;
    this.trans_table = b || {};
    this.trans_table_scope = a || window;
    Ext.ux.Utils.FSA.superclass.constructor.call(this, this.processEvent, this)
};
Ext.extend(Ext.ux.Utils.FSA, Ext.ux.Utils.EventQueue, {
    current_state: null,
    trans_table: null,
    trans_table_scope: null,
    state: function () {
        return this.current_state
    },
    processEvent: function (a, d) {
        var h = this.currentStateEventTransitions(a);
        if (!h) {
            return
        }
        for (var e = 0, f = h.length; e < f; e++) {
            var g = h[e], j = g.predicate || g.p || true, c = g.action || g.a || Ext.emptyFn, b = g.state || g.s || this.current_state, k = g.scope || this.trans_table_scope;
            if (this.computePredicate(j, k, d, a)) {
                this.callAction(c, k, d, a);
                this.current_state = b;
                return
            }
        }
    },
    currentStateEventTransitions: function (a) {
        return this.trans_table[this.current_state] ? this.trans_table[this.current_state][a] || false : false
    },
    computePredicate: function (c, e, g, f) {
        var b = false;
        switch (Ext.type(c)) {
            case"function":
                b = c.call(e, g, f, this);
                break;
            case"array":
                b = true;
                for (var d = 0, a = c.length; b && (d < a); d++) {
                    if (Ext.type(c[d]) == "function") {
                        b = c[d].call(e, g, f, this)
                    } else {
                        throw ["Predicate: ", c[d], ' is not callable in "', this.current_state, '" state for event "', f].join("")
                    }
                }
                break;
            case"boolean":
                b = c;
                break;
            default:
                throw ["Predicate: ", c, ' is not callable in "', this.current_state, '" state for event "', f].join("")
        }
        return b
    },
    callAction: function (f, c, e, d) {
        switch (Ext.type(f)) {
            case"array":
                for (var b = 0, a = f.length; b < a; b++) {
                    if (Ext.type(f[b]) == "function") {
                        f[b].call(c, e, d, this)
                    } else {
                        throw ["Action: ", f[b], ' is not callable in "', this.current_state, '" state for event "', d].join("")
                    }
                }
                break;
            case"function":
                f.call(c, e, d, this);
                break;
            default:
                throw ["Action: ", f, ' is not callable in "', this.current_state, '" state for event "', d].join("")
        }
    }
});
Ext.define("Deppon.ux.UploadDialog", {
    statics: {
        STATE_QUEUE: 0,
        STATE_FINISHED: 1,
        STATE_FAILED: 2,
        STATE_PROCESSING: 3,
        title: "File upload dialog",
        state_col_title: "State",
        filename_col_title: "Filename",
        note_col_title: "Note",
        add_btn_text: "Add",
        remove_btn_text: "Remove",
        remove_btn_tip: "Remove the aborted file from upload queue.",
        upload_btn_start_text: "Upload",
        upload_btn_stop_text: "Abort",
        upload_btn_start_tip: "Upload queued files to the server.",
        upload_btn_stop_tip: "Stop upload.",
        error_msgbox_title: "Error",
        err_exceed_file_count: "Exceed the limit of the file queue. Please select less than {0} file(s)",
        err_file_type_not_permitted: "Selected file extension isn't permitted.<br/>Please select files with following extensions: {0}",
        note_queued_to_upload: "Queued for upload.",
        note_processing: "Uploading...",
        note_upload_failed: "Server is unavailable or internal server error occured.",
        note_upload_success: "OK.",
        note_upload_error: "Upload error.",
        note_aborted: "Upload aborted.",
        note_canceled: "Upload canceled."
    }
});
Ext.define("Deppon.ux.UploadDialog.BrowseButton", {
    extend: "Ext.button.Button",
    alias: "widget.browsebutton",
    input_name: "file",
    input_file: null,
    original_handler: null,
    original_scope: null,
    initComponent: function () {
        var a = this;
        a.callParent(arguments);
        a.original_handler = a.handler || null;
        a.original_scope = a.scope || window;
        a.handler = null;
        a.scope = null
    },
    onRender: function () {
        this.callParent(arguments);
        this.createInputFile()
    },
    createInputFile: function () {
        var a = this, b = a.el;
        b.position("relative");
        a.input_file = Ext.DomHelper.append(b, {
            tag: "input",
            type: "file",
            size: 1,
            name: a.input_name || Ext.id(a.el),
            style: "position: absolute; display: block; border: none; cursor: pointer"
        }, true);
        a.input_file.setOpacity(0);
        a.adjustInputFileBox();
        a.input_file.on("change", a.onInputFileChange, a);
        a.input_file.on("click", function (c) {
            c.stopPropagation()
        })
    },
    autoWidth: function () {
        this.callParent(arguments);
        this.adjustInputFileBox()
    },
    adjustInputFileBox: function () {
        var b = this, d, c, e, a;
        if (b.el && b.input_file) {
            d = b.el;
            c = d.getBox();
            b.input_file.setStyle("font-size", (c.width * 0.5) + "px");
            e = b.input_file.getBox();
            a = {x: 3, y: 3};
            if (Ext.isIE) {
                a = {x: 0, y: 3}
            }
            b.input_file.setLeft(c.width - e.width + a.x + "px");
            b.input_file.setTop(c.height - e.height + a.y + "px")
        }
    },
    detachInputFile: function (b) {
        var c = this, a = c.input_file;
        b = b || false;
        c.input_file.removeAllListeners();
        c.input_file = null;
        if (!b) {
            c.createInputFile()
        }
        return a
    },
    getInputFile: function () {
        return this.input_file
    },
    disable: function () {
        this.callParent(arguments);
        this.input_file.dom.disabled = true
    },
    enable: function () {
        this.callParent(arguments);
        this.input_file.dom.disabled = false
    },
    destroy: function () {
        var a = this.detachInputFile(true);
        a.remove();
        a = null;
        this.callParent(arguments)
    },
    onInputFileChange: function () {
        if (this.original_handler) {
            this.original_handler.call(this.original_scope, this)
        }
    }
});
Ext.define("Deppon.ux.UploadDialog.Dialog", {
    extend: "Ext.window.Window",
    alias: "widget.uploaddialog",
    border: false,
    width: 450,
    height: 300,
    minWidth: 450,
    minHeight: 300,
    plain: true,
    constrainHeader: true,
    draggable: true,
    closable: true,
    maximizable: false,
    minimizable: false,
    resizable: true,
    autoDestroy: true,
    modal: true,
    closeAction: "hide",
    layout: "fit",
    url: "",
    modulePath: "",
    base_params: {},
    permitted_extensions: [],
    file_upload_limit: 20,
    reset_on_hide: true,
    allow_close_on_upload: false,
    upload_autostart: false,
    post_var_name: "file",
    fsa: null,
    state_tpl: null,
    form: null,
    grid_panel: null,
    is_uploading: false,
    initial_queued_count: 0,
    upload_frame: null,
    initComponent: function () {
        var b = this;
        b.callParent(arguments);
        b.setTitle(Deppon.ux.UploadDialog.title);
        var a = {
            created: {
                "window-render": [{action: [this.createForm, this.createGrid], state: "rendering"}],
                destroy: [{action: this.flushEventQueue, state: "destroyed"}]
            },
            rendering: {
                "grid-render": [{action: [this.fillToolbar, this.updateToolbar], state: "ready"}],
                destroy: [{action: this.flushEventQueue, state: "destroyed"}]
            },
            ready: {
                "file-selected": [{
                    predicate: [this.isPermittedFile],
                    action: this.addFileToUploadQueue,
                    state: "adding-file"
                }, {}],
                "grid-selection-change": [{action: this.updateToolbar}],
                "remove-files": [{action: [this.removeFiles, this.fireFileRemoveEvent]}],
                "reset-queue": [{action: [this.resetQueue, this.fireResetQueueEvent]}],
                "start-upload": [{
                    predicate: this.hasUnuploadedFiles,
                    action: [this.setUploadingFlag, this.saveInitialQueuedCount, this.updateToolbar, this.prepareNextUploadTask, this.fireUploadStartEvent],
                    state: "uploading"
                }, {}],
                "stop-upload": [{}],
                hide: [{
                    predicate: [this.isNotEmptyQueue, this.getResetOnHide],
                    action: [this.resetQueue, this.fireResetQueueEvent]
                }, {}],
                destroy: [{action: this.flushEventQueue, state: "destroyed"}]
            },
            "adding-file": {
                "file-added": [{
                    predicate: this.isUploading,
                    action: [this.incInitialQueuedCount, this.fireFileAddEvent],
                    state: "uploading"
                }, {
                    predicate: this.getUploadAutostart,
                    action: [this.startUpload, this.fireFileAddEvent],
                    state: "ready"
                }, {action: [this.updateToolbar, this.fireFileAddEvent], state: "ready"}]
            },
            uploading: {
                "file-selected": [{
                    predicate: [this.isPermittedFile],
                    action: this.addFileToUploadQueue,
                    state: "adding-file"
                }, {action: this.resetAddButton}],
                "grid-selection-change": [{}],
                "start-upload": [{}],
                "stop-upload": [{
                    predicate: this.hasUnuploadedFiles,
                    action: [this.resetUploadingFlag, this.abortUpload, this.updateToolbar, this.fireUploadStopEvent],
                    state: "ready"
                }, {
                    action: [this.resetUploadingFlag, this.abortUpload, this.updateToolbar, this.fireUploadStopEvent, this.fireUploadCompleteEvent],
                    state: "ready"
                }],
                "file-upload-start": [{action: [this.uploadFile, this.findUploadFrame, this.fireFileUploadStartEvent]}],
                "file-upload-success": [{
                    predicate: this.hasUnuploadedFiles,
                    action: [this.resetUploadFrame, this.updateRecordState, this.prepareNextUploadTask, this.fireUploadSuccessEvent]
                }, {
                    action: [this.resetUploadFrame, this.resetUploadingFlag, this.updateRecordState, this.updateToolbar, this.fireUploadSuccessEvent, this.fireUploadCompleteEvent],
                    state: "ready"
                }],
                "file-upload-error": [{
                    predicate: this.hasUnuploadedFiles,
                    action: [this.resetUploadFrame, this.updateRecordState, this.prepareNextUploadTask, this.fireUploadErrorEvent]
                }, {
                    action: [this.resetUploadFrame, this.resetUploadingFlag, this.updateRecordState, this.updateToolbar, this.fireUploadErrorEvent, this.fireUploadCompleteEvent],
                    state: "ready"
                }],
                "file-upload-failed": [{
                    predicate: this.hasUnuploadedFiles,
                    action: [this.resetUploadFrame, this.updateRecordState, this.prepareNextUploadTask, this.fireUploadFailedEvent]
                }, {
                    action: [this.resetUploadFrame, this.resetUploadingFlag, this.updateRecordState, this.updateToolbar, this.fireUploadFailedEvent, this.fireUploadCompleteEvent],
                    state: "ready"
                }],
                hide: [{predicate: this.getResetOnHide, action: [this.stopUpload, this.repostHide]}, {}],
                destroy: [{
                    predicate: this.hasUnuploadedFiles,
                    action: [this.resetUploadingFlag, this.abortUpload, this.fireUploadStopEvent, this.flushEventQueue],
                    state: "destroyed"
                }, {
                    action: [this.resetUploadingFlag, this.abortUpload, this.fireUploadStopEvent, this.fireUploadCompleteEvent, this.flushEventQueue],
                    state: "destroyed"
                }]
            },
            destroyed: {}
        };
        b.fsa = new Ext.ux.Utils.FSA("created", a, b);
        b.addEvents({
            fileadd: true,
            fileremove: true,
            resetqueue: true,
            uploadsuccess: true,
            uploaderror: true,
            uploadfailed: true,
            uploadcanceled: true,
            uploadstart: true,
            uploadstop: true,
            uploadcomplete: true,
            beforefileuploadstart: true,
            fileuploadstart: true
        });
        b.on("render", b.onWindowRender, b);
        b.on("beforehide", b.onWindowBeforeHide, b);
        b.on("hide", b.onWindowHide, b);
        b.on("destroy", b.onWindowDestroy, b);
        b.state_tpl = new Ext.Template("<div class='ext-ux-uploaddialog-state ext-ux-uploaddialog-state-{state}'>&#160;</div>").compile()
    },
    createForm: function () {
        this.form = Ext.DomHelper.append(this.getId() + "-body", {
            tag: "form",
            method: "post",
            action: this.url,
            style: "position: absolute; left: -100px; top: -100px; width: 100px; height: 100px"
        })
    },
    createGrid: function () {
        var c = this, a, b;
        columns = [{
            header: Deppon.ux.UploadDialog.state_col_title,
            width: 65,
            resizable: false,
            sortable: false,
            dataIndex: "state",
            renderer: Ext.bind(c.renderStateCell, c)
        }, {
            header: Deppon.ux.UploadDialog.filename_col_title,
            width: 230,
            sortable: true,
            dataIndex: "filename",
            renderer: c.renderFilenameCell
        }, {
            header: Deppon.ux.UploadDialog.note_col_title,
            width: 150,
            sortable: true,
            dataIndex: "note",
            renderer: c.renderNoteCell
        }];
        a = Ext.create("Ext.data.Store", {
            fields: ["id", "state", "filename", "note", "input_element", "relativePath"],
            data: []
        });
        c.grid_panel = Ext.create("Ext.grid.Panel", {
            store: a,
            columns: columns,
            forceFit: true,
            dockedItems: [{xtype: "toolbar", dock: "top"}]
        });
        c.grid_panel.on("render", c.onGridRender, c);
        c.add(c.grid_panel);
        c.grid_panel.getSelectionModel().on("selectionchange", c.onGridSelectionChange, c)
    },
    fillToolbar: function () {
        var b = this, a = b.grid_panel.getDockedItems('toolbar[dock="top"]')[0];
        a.x_buttons = {};
        a.x_buttons.add = a.add({
            xtype: "browsebutton",
            input_name: b.post_var_name,
            text: Deppon.ux.UploadDialog.add_btn_text,
            iconCls: "ext-ux-uploaddialog-addbtn",
            handler: b.onAddButtonFileSelected,
            scope: b
        });
        a.x_buttons.remove = a.add({
            text: Deppon.ux.UploadDialog.remove_btn_text,
            tooltip: Deppon.ux.UploadDialog.remove_btn_tip,
            iconCls: "ext-ux-uploaddialog-removebtn",
            handler: b.onRemoveButtonClick,
            scope: b
        });
        a.add("-");
        a.x_buttons.upload = a.add({
            text: Deppon.ux.UploadDialog.upload_btn_start_text,
            tooltip: Deppon.ux.UploadDialog.upload_btn_start_tip,
            iconCls: "ext-ux-uploaddialog-uploadstartbtn",
            handler: b.onUploadButtonClick,
            scope: b
        })
    },
    updateToolbar: function () {
        var b = this, a = b.grid_panel.getDockedItems('toolbar[dock="top"]')[0];
        Ext.suspendLayouts();
        if (b.is_uploading) {
            a.x_buttons.remove.disable();
            a.x_buttons.upload.enable();
            a.x_buttons.upload.setIconCls("ext-ux-uploaddialog-uploadstopbtn");
            a.x_buttons.upload.setText(Deppon.ux.UploadDialog.upload_btn_stop_text);
            a.x_buttons.upload.setTooltip(Deppon.ux.UploadDialog.upload_btn_stop_tip)
        } else {
            a.x_buttons.remove.enable();
            a.x_buttons.upload.setIconCls("ext-ux-uploaddialog-uploadstartbtn");
            a.x_buttons.upload.setText(Deppon.ux.UploadDialog.upload_btn_start_text);
            a.x_buttons.upload.setTooltip(Deppon.ux.UploadDialog.upload_btn_start_tip);
            if (b.getQueuedCount() > 0) {
                a.x_buttons.upload.enable()
            } else {
                a.x_buttons.upload.disable()
            }
            if (b.grid_panel.getStore().getCount() > 0) {
                a.x_buttons.remove.enable()
            } else {
                a.x_buttons.remove.disable()
            }
        }
        Ext.resumeLayouts(true)
    },
    renderStateCell: function (e, b, a, f, d, c) {
        return this.state_tpl.apply({state: e})
    },
    renderFilenameCell: function (e, b, a, f, d, c) {
        b.tdAttr = 'data-qtip="' + e + '"';
        return e
    },
    renderNoteCell: function (e, b, a, f, d, c) {
        b.tdAttr = 'data-qtip="' + e + '"';
        return e
    },
    getFileExtension: function (b) {
        var a = null, c = b.split(".");
        if (c.length > 1) {
            a = c.pop()
        }
        return a
    },
    isPermittedFileType: function (c) {
        var b = true, e, a = this.permitted_extensions.length;
        if (a > 0) {
            e = this.getFileExtension(c).toLowerCase();
            for (var d = 0; d < a; d++) {
                this.permitted_extensions[d] = this.permitted_extensions[d].toLowerCase()
            }
            b = this.permitted_extensions.indexOf(e) != -1
        }
        return b
    },
    isPermittedFile: function (c) {
        var a = false, b = c.getInputFile().dom.value;
        if (this.isPermittedFileType(b)) {
            a = true
        } else {
            Ext.MessageBox.alert(Deppon.ux.UploadDialog.error_msgbox_title, Ext.String.format(Deppon.ux.UploadDialog.err_file_type_not_permitted, this.permitted_extensions.join(",")));
            a = false
        }
        return a
    },
    addFileToUploadQueue: function (c) {
        var a = c.detachInputFile(), b = this.grid_panel.getStore(), d;
        if (b.getCount() + 1 <= this.file_upload_limit) {
            a.appendTo(this.form);
            a.setStyle("width", "100px");
            a.dom.disabled = true;
            d = a.dom.value.split("\\").pop();
            b.add({
                id: Ext.data.IdGenerator.get("uuid").generate(),
                state: Deppon.ux.UploadDialog.STATE_QUEUE,
                filename: d,
                note: Deppon.ux.UploadDialog.note_queued_to_upload,
                input_element: a,
                relativePath: ""
            })
        } else {
            Ext.MessageBox.alert(Deppon.ux.UploadDialog.error_msgbox_title, Ext.String.format(Deppon.ux.UploadDialog.err_exceed_file_count, this.file_upload_limit))
        }
        this.fsa.postEvent("file-added", a.dom.value)
    },
    saveInitialQueuedCount: function () {
        this.initial_queued_count = this.getQueuedCount()
    },
    incInitialQueuedCount: function () {
        this.initial_queued_count++
    },
    setUploadingFlag: function () {
        this.is_uploading = true
    },
    resetUploadingFlag: function () {
        this.is_uploading = false
    },
    prepareNextUploadTask: function () {
        var b = this.grid_panel.getStore(), a = null;
        b.each(function (c) {
            if (!a && c.get("state") == Deppon.ux.UploadDialog.STATE_QUEUE) {
                a = c
            } else {
                c.get("input_element").dom.disabled = true
            }
        });
        a.get("input_element").dom.disabled = false;
        a.set("state", Deppon.ux.UploadDialog.STATE_PROCESSING);
        a.set("note", Deppon.ux.UploadDialog.note_processing);
        a.commit();
        this.fsa.postEvent("file-upload-start", a)
    },
    removeFiles: function (d) {
        var b = this.grid_panel.getStore(), a;
        for (var c = b.getCount() - 1; c >= 0; c--) {
            a = b.getAt(c);
            if (a.get("state") != 1) {
                a.get("input_element").remove();
                b.remove(a)
            }
        }
    },
    resetQueue: function () {
        var a = this.grid_panel.getStore();
        a.each(function (b) {
            b.get("input_element").remove()
        });
        a.removeAll()
    },
    uploadFile: function (a) {
        var b = this;
        b.base_params = {
            id: a.get("id"),
            modulePath: b.modulePath,
            fileName: a.get("filename"),
            fileType: a.get("filename").split(".").pop()
        };
        Ext.Ajax.request({
            url: b.url,
            params: b.base_params || b.baseParams || b.params,
            method: "POST",
            form: b.form,
            isUpload: true,
            success: b.onAjaxSuccess,
            exception: b.onAjaxFailure,
            scope: b,
            record: a
        })
    },
    updateRecordState: function (a) {
        if ("success" in a.response && a.response.success) {
            a.record.set("state", Deppon.ux.UploadDialog.STATE_FINISHED);
            a.record.set("note", a.response.message || a.response.error || Deppon.ux.UploadDialog.note_upload_success);
            a.record.set("relativePath", a.response.relativePath)
        } else {
            a.record.set("state", Deppon.ux.UploadDialog.STATE_FAILED);
            a.record.set("note", a.response.message || a.response.error || Deppon.ux.UploadDialog.note_upload_error)
        }
        a.record.commit()
    },
    fireFileAddEvent: function (a) {
        this.fireEvent("fileadd", this, a)
    },
    fireUploadStartEvent: function () {
        this.fireEvent("uploadstart", this)
    },
    fireFileRemoveEvent: function () {
        this.fireEvent("fileremove", this)
    },
    fireResetQueueEvent: function () {
        this.fireEvent("resetqueue", this)
    },
    fireFileUploadStartEvent: function (a) {
        this.fireEvent("fileuploadstart", this, a.get("filename"))
    },
    fireUploadSuccessEvent: function (a) {
        this.fireEvent("uploadsuccess", this, a.record.get("filename"), a.response)
    },
    fireUploadErrorEvent: function (a) {
        this.fireEvent("uploaderror", this, a.record.get("filename"), a.response)
    },
    fireUploadFailedEvent: function (a) {
        this.fireEvent("uploadfailed", this, a.record.get("filename"))
    },
    fireUploadCompleteEvent: function () {
        this.fireEvent("uploadcomplete", this)
    },
    fireUploadStopEvent: function () {
        this.fireEvent("uploadstop", this)
    },
    findUploadFrame: function () {
        this.upload_frame = Ext.getBody().child("iframe.x-hidden:last")
    },
    resetUploadFrame: function () {
        this.upload_frame = null
    },
    removeUploadFrame: function () {
        if (this.upload_frame) {
            this.upload_frame.removeAllListeners();
            this.upload_frame.dom.src = "about:blank";
            this.upload_frame.remove()
        }
        this.upload_frame = null
    },
    abortUpload: function () {
        this.removeUploadFrame();
        var b = this.grid_panel.getStore(), a = null;
        b.each(function (c) {
            if (c.get("state") == Deppon.ux.UploadDialog.STATE_PROCESSING) {
                a = c;
                return false
            }
        });
        a.set("state", Deppon.ux.UploadDialog.STATE_FAILED);
        a.set("note", Deppon.ux.UploadDialog.note_aborted);
        a.commit()
    },
    repostHide: function () {
        this.fsa.postEvent("hide")
    },
    flushEventQueue: function () {
        this.fsa.flushEventQueue()
    },
    onWindowRender: function () {
        this.fsa.postEvent("window-render")
    },
    onWindowBeforeHide: function () {
        return this.isUploading() ? this.getAllowCloseOnUpload() : true
    },
    onWindowHide: function () {
        this.fsa.postEvent("hide")
    },
    onWindowDestroy: function () {
        this.fsa.postEvent("destroy")
    },
    onGridRender: function () {
        this.fsa.postEvent("grid-render")
    },
    onGridSelectionChange: function () {
        this.fsa.postEvent("grid-selection-change")
    },
    onAddButtonFileSelected: function (a) {
        this.fsa.postEvent("file-selected", a)
    },
    onUploadButtonClick: function () {
        if (this.is_uploading) {
            this.fsa.postEvent("stop-upload")
        } else {
            this.fsa.postEvent("start-upload")
        }
    },
    onRemoveButtonClick: function () {
        this.fsa.postEvent("remove-files")
    },
    onResetButtonClick: function () {
        this.fsa.postEvent("reset-queue")
    },
    onCloseButtonClick: function () {
        this[this.closeAction].call(this)
    },
    onAjaxSuccess: function (c, d) {
        var a = {success: false, error: Deppon.ux.UploadDialog.note_upload_error};
        try {
            var b = c.responseText;
            var f = b.match(/^<[^>]+>((?:.|\n)*)<\/[^>]+>$/);
            if (f) {
                b = f[1]
            }
            a = Ext.JSON.decode(b)
        } catch (h) {
            throw"Excepion appeared in the [Success Function] of [Ajax Request]."
        }
        var g = {record: d.record, response: a};
        if ("success" in a && a.success) {
            this.fsa.postEvent("file-upload-success", g)
        } else {
            this.fsa.postEvent("file-upload-error", g)
        }
    },
    onAjaxFailure: function (a, b) {
        var c = Ext.decode(a.responseText), d = Deppon.ux.UploadDialog.note_upload_failed;
        if (!Ext.isEmpty(c) && !Ext.isEmpty(c.message)) {
            d = d + ":" + c.message
        }
        var e = {record: b.record, response: {success: false, error: d}};
        this.fsa.postEvent("file-upload-failed", e)
    },
    startUpload: function () {
        this.fsa.postEvent("start-upload")
    },
    stopUpload: function () {
        this.fsa.postEvent("stop-upload")
    },
    getUrl: function () {
        return this.url
    },
    setUrl: function (a) {
        this.url = a
    },
    getBaseParams: function () {
        return this.base_params
    },
    setBaseParams: function (a) {
        this.base_params = a
    },
    getUploadAutostart: function () {
        return this.upload_autostart
    },
    setUploadAutostart: function (a) {
        this.upload_autostart = a
    },
    getAllowCloseOnUpload: function () {
        return this.allow_close_on_upload
    },
    setAllowCloseOnUpload: function (a) {
        this.allow_close_on_upload = a
    },
    getResetOnHide: function () {
        return this.reset_on_hide
    },
    setResetOnHide: function (a) {
        this.reset_on_hide = a
    },
    getPermittedExtensions: function () {
        return this.permitted_extensions
    },
    setPermittedExtensions: function (a) {
        this.permitted_extensions = a
    },
    isUploading: function () {
        return this.is_uploading
    },
    isNotEmptyQueue: function () {
        return this.grid_panel.getStore().getCount() > 0
    },
    getQueuedCount: function (b) {
        var c = 0, a = this.grid_panel.getStore();
        a.each(function (d) {
            if (d.get("state") == Deppon.ux.UploadDialog.STATE_QUEUE) {
                c++
            }
            if (b && d.get("state") == Deppon.ux.UploadDialog.STATE_PROCESSING) {
                c++
            }
        });
        return c
    },
    hasUnuploadedFiles: function () {
        return this.getQueuedCount() > 0
    }
});
Ext.define("Deppon.ux.FileUploadGrid", {
    extend: "Ext.grid.Panel",
    alias: "widget.fileuploadgrid",
    statics: {
        file_name_header: "File Name",
        file_type_header: "Extension",
        down_load_tip: "Download File",
        preview_load_tip: "Preview Image File",
        upload_btn_text: "Upload",
        delete_btn_text: "Delete",
        warn_msgbox_title: "Warning",
        warn_del_message: "Are you sure to delete the file?",
        warn_notsel_message: "Please select at least one file to oprate!",
        img_preview_title: "Image Preview"
    },
    frame: true,
    enableColumnHide: false,
    sortableColumns: false,
    reviewFlag: false,
    uploadWin: null,
    uploadUrl: "",
    downLoadUrl: "",
    deleteUrl: "",
    imgReviewUrl: "",
    modulePath: "",
    initComponent: function () {
        var a = this;
        a.columns = [{
            header: Deppon.ux.FileUploadGrid.file_name_header,
            flex: 1,
            sortable: true,
            dataIndex: "fileName"
        }, {
            header: Deppon.ux.FileUploadGrid.file_type_header,
            width: 60,
            sortable: true,
            dataIndex: "fileType"
        }, {
            xtype: "actioncolumn",
            width: 50,
            items: [{
                iconCls: "deppon_icons_download",
                tooltip: Deppon.ux.FileUploadGrid.down_load_tip,
                handler: a.onDownloadFile,
                scope: a
            }, {
                tooltip: Deppon.ux.FileUploadGrid.preview_load_tip,
                handler: a.onPreviewImgFile,
                scope: a,
                getClass: a.getReviewCls
            }]
        }];
        a.store = Ext.create("Ext.data.Store", {
            fields: ["id", "fileName", "fileType", "relativePath", "status"],
            data: []
        });
        a.dockedItems = [{
            xtype: "toolbar",
            hidden: a.reviewFlag,
            dock: "top",
            items: [{
                xtype: "button",
                text: Deppon.ux.FileUploadGrid.upload_btn_text,
                handler: a.onUploadFiles,
                scope: a
            }, {xtype: "button", text: Deppon.ux.FileUploadGrid.delete_btn_text, handler: a.onDeleteFile, scope: a}]
        }];
        a.callParent(arguments)
    },
    onUploadFiles: function () {
        var c = this, b, a;
        if (c.uploadWin == null) {
            c.uploadWin = Ext.create("Deppon.ux.UploadDialog.Dialog", {
                closeAction: "hide",
                reset_on_hide: true,
                allow_close_on_upload: true,
                permitted_extensions: c.fileTypes || [],
                url: c.uploadUrl || "",
                modulePath: c.modulePath || "",
                file_upload_limit: c.file_upload_limit || 20
            });
            c.uploadWin.on("beforehide", c.saveAttachementInfo, c)
        }
        c.uploadWin.show()
    },
    saveAttachementInfo: function () {
        var f = this, g = f.uploadWin, d = g.down("grid"), b = d.store, e = b.getCount(), a;
        if (e > 0) {
            for (var c = 0; c < e; c++) {
                a = b.getAt(c);
                if (a.get("state") == 1) {
                    f.store.add({
                        id: a.get("id"),
                        fileName: a.get("filename"),
                        fileType: a.get("filename").split(".").pop(),
                        relativePath: a.get("relativePath"),
                        status: "add"
                    })
                }
            }
        }
    },
    onDeleteFile: function () {
        var b = this, a = b.store, d = b.getSelectionModel(), c;
        if (d.hasSelection()) {
            Ext.MessageBox.confirm(Deppon.ux.FileUploadGrid.warn_msgbox_title, Deppon.ux.FileUploadGrid.warn_del_message, function (h) {
                if (h == "yes") {
                    var g = b.store, k = b.getSelectionModel(), i = k.getSelection(), e = i[0], j = e.get("id"), f = e.get("relativePath");
                    Ext.Ajax.request({
                        url: b.deleteUrl || "",
                        method: "post",
                        params: {id: j, relativePath: f},
                        success: function (l) {
                            g.remove(e)
                        },
                        exception: function (l) {
                            var m = Ext.decode(l.responseText);
                            Ext.ux.Toast.msg(Deppon.ux.FileUploadGrid.warn_msgbox_title, m.message, "error", 2000)
                        }
                    })
                }
            })
        } else {
            Ext.MessageBox.alert(Deppon.ux.FileUploadGrid.warn_msgbox_title, Deppon.ux.FileUploadGrid.warn_notsel_message)
        }
    },
    onDownloadFile: function (c, e, b) {
        var d = this, a = c.store.getAt(e);
        fileName = a.get("fileName"), relativePath = a.get("relativePath");
        window.open(d.downLoadUrl + "?fileName=" + fileName + "&relativePath=" + relativePath)
    },
    onPreviewImgFile: function (d, f, c) {
        var e = this;
        if (e.imgReviewUrl) {
            var a = d.store.getAt(f), b = a.get("relativePath");
            if (!e.reviewWin) {
                e.reviewWin = Ext.create("Ext.window.Window", {
                    title: Deppon.ux.FileUploadGrid.img_preview_title,
                    cls:'fileUp-window',
                    width: 600,
                    height: 400,
                    modal: true,
                    resizable: false,
                    layout: "auto",
                    closeAction: "hide"
                })
            }
            Ext.suspendLayouts();
            e.reviewWin.removeAll(true);
            e.reviewWin.add({xtype: "image", src: e.imgReviewUrl + "?relativePath=" + b});
            Ext.resumeLayouts(true);
            e.reviewWin.down("image").on("render", e.onRenderImage, e.reviewWin);
            Ext.defer(function () {
                this.reviewWin.show()
            }, 500, e)
        }
    },
    onRenderImage: function () {
        var a = this, b = a.down("image"), c = b.getEl();
        c.dom.onload = function () {
            var h = this, i = a, f, e, g, d;
            f = Ext.fly(i.getId() + "-body").getWidth() - 4;
            e = Ext.fly(i.getId() + "-body").getHeight() - 4;
            g = h.width;
            d = h.height;
            if (f > g && e > d) {
            } else {
                if (f < g && e > d) {
                    h.width = f;
                    h.height = f * d / g
                } else {
                    if (f > g && e < d) {
                        h.width = g * e / d;
                        h.height = e
                    } else {
                        if (f < g && e < d) {
                            if (g / d > f / e) {
                                h.width = f;
                                h.height = f * d / g
                            } else {
                                if (g / d < f / e) {
                                    h.width = g * e / d;
                                    h.height = e
                                }
                            }
                        }
                    }
                }
            }
            i.setBodyStyle("text-align:center;top:50%;margin-top:-" + h.height / 2 + "px");
            i = null
        }
    },
    getReviewCls: function (e, b, a, g) {
        var d = a.get("fileType"), c = /(jpg|jpeg|gif|bmp|png)$/ig, f = c.test(d);
        if (f) {
            return "deppon_icons_showdetail"
        }
    }
});
Ext.define("Deppon.form.HtmlEditor.imageUpload", {
    alias: "plugin.imageUpload",
    alternateClassName: "Ext.ux.form.HtmlEditor.imageUpload",
    lang: {
        "Insert/Edit Image": "插入图片",
        "Upload Image...": "浏览",
        "Uploading your photo...": "上传中...",
        Error: "Error",
        "Focus first": "请设置要插入图片的位置",
        OK: "保存",
        Cancel: "关闭",
        Confirmation: "",
        "Are you sure you want to delete this image?": "",
        "Your photo has been uploaded.": "上传成功"
    },
    submitUrl: "htmlEditorImageUpload.php",
    disableServerSideEdit: false,
    disableDelete: false,
    disableStyling: false,
    managerUrl: "htmlEditorImageUpload.php",
    pageSize: 6,
    dragResize: true,
    enableContextMenu: false,
    wheelResize: true,
    iframeCss: "css/iframe_styles.css",
    t: function (a) {
        return this.lang[a] ? this.lang[a] : a
    },
    constructor: function (a) {
        Ext.apply(this, a);
        this.callParent(arguments)
    },
    init: function (a) {
        this.cmp = a;
        this.cmp.on("render", this.onRender, this);
        this.cmp.on("initialize", this.initialize, this);
        this.cmp.on("beforedestroy", this.beforeDestroy, this)
    },
    initialize: function () {
        var b = this;
        var a = this.cmp.getDoc();
        b.flyDoc = Ext.fly(a);
        if (b.enableContextMenu) {
            b.cmp.mon(b.flyDoc, "dblclick", b._dblClick, b, {delegate: "img"})
        }
        b.cmp.mon(b.flyDoc, "mouseup", b._docMouseUp, b);
        b.cmp.mon(b.flyDoc, "paste", b._removeSelectionHelpers, b);
        if ((Ext.isWebKit || Ext.isOpera) && b.wheelResize) {
            b.cmp.mon(b.flyDoc, "mousewheel", b._wheelResize, b, {delegate: "img"})
        }
        if (Ext.isWebKit && b.dragResize) {
            b.cmp.mon(b.flyDoc, "drag", b._dragResize, b, {delegate: "img"})
        }
    },
    beforeDestroy: function () {
        var a = this;
        if (a.uploadDialog) {
            a.uploadDialog.destroy()
        }
        if (a.contextMenu) {
            a.contextMenu.destroy()
        }
    },
    onRender: function () {
        var b = this;
        var a = Ext.create("Ext.button.Button", {
            iconCls: "x-htmleditor-imageupload",
            handler: b._openImageDialog,
            scope: b,
            tooltip: b.t("Insert/Edit Image"),
            overflowText: b.t("Insert/Edit Image")
        });
        b.imageButton = a;
        b.cmp.getToolbar().add(a)
    },
    _injectCss: function (e, a) {
        var b = e.iframeEl.dom.name;
        var d;
        if (document.frames) {
            d = document.frames[b]
        } else {
            d = window.frames[b]
        }
        var c = d.document.createElement("link");
        c.type = "text/css";
        c.rel = "stylesheet";
        c.href = a;
        if (document.all) {
            d.document.createStyleSheet(c.href)
        } else {
            d.document.getElementsByTagName("head")[0].appendChild(c)
        }
    },
    _dblClick: function (a) {
        var b = this;
        var c = a.getTarget();
        if (c.tagName == "IMG") {
            b._openImageDialog()
        }
    },
    _openImageDialog: function () {
        var i = this;
        var k = this.cmp.getDoc();
        var h = this.cmp.win;
        var b = "";
        var g = "";
        var e = "";
        var j = k.body.getElementsByTagName("IMG");
        var c = j.length;
        var d = k.selection && k.selection.createRange ? true : false;
        var a = h.getSelection && h.getSelection().getRangeAt ? true : false;
        if (a) {
            b = h.getSelection();
            try {
                g = b.getRangeAt(0)
            } catch (f) {
                Ext.Msg.alert("", i.t("Focus first"));
                return
            }
        } else {
            if (d) {
                h.focus();
                b = k.selection;
                g = b.createRange()
            }
        }
        i.uploadDialog = Ext.create("Ext.ux.form.HtmlEditor.ImageDialog", {
            lang: i.lang,
            t: i.t,
            submitUrl: i.submitUrl,
            managerUrl: i.managerUrl,
            iframeDoc: k,
            imageToEdit: e,
            pageSize: i.pageSize,
            imageButton: i.imageButton,
            disableServerSideEdit: i.serverSideEdit,
            disableStyling: i.styling,
            disableDelete: i.disableDelete
        });
        i.uploadDialog.on("close", function () {
            if (Ext.isIE) {
                i.imageButton.toggle(false);
                i._removeSelectionHelpers()
            }
        }, i);
        i.uploadDialog.on("imageloaded", function () {
            var n = this.getImage();
            if (e != "") {
                for (var m = 0; m < c; m++) {
                    if (parseInt(j[m].getAttribute("iu_edit")) > 0) {
                        if (a) {
                            j[m].parentNode.replaceChild(n, j[m]);
                            try {
                                if (b) {
                                    b.selectAllChildren(k.body);
                                    b.collapseToStart()
                                }
                            } catch (l) {
                            }
                        } else {
                            if (d) {
                                j[m].outerHTML = n.outerHTML
                            }
                        }
                        break
                    }
                }
            } else {
                if (a) {
                    g.insertNode(n)
                } else {
                    if (d) {
                        h.focus();
                        g.select();
                        g.pasteHTML(n.outerHTML)
                    }
                }
            }
            i.imageToEdit = "";
            this.close();
            i.imageButton.toggle(false)
        });
        i.uploadDialog.show()
    },
    _removeSelectionHelpers: function () {
        var d = this;
        var b = d.cmp.getDoc().body.getElementsByTagName("IMG");
        var a = b.length;
        for (var c = 0; c < a; c++) {
            b[c].removeAttribute("iu_edit")
        }
    },
    _wheelResize: function (c) {
        var b = c.getTarget();
        if (b.tagName == "IMG" && b.getAttribute("iu_edit") == 1) {
            var d = c.getWheelDelta();
            var a = b.style.width ? parseInt(b.style.width.replace(/[^\d.]/g, "")) : b.width;
            b.removeAttribute("height");
            b.style.removeProperty("height");
            b.style.width = (d < 1) ? a - 10 : a + 10;
            c.preventDefault()
        } else {
            return
        }
    },
    _dragResize: function (d) {
        var c = d.getTarget();
        if (c.tagName == "IMG" && (c.getAttribute("iu_edit") == 1)) {
            var b = d.getX() - c.offsetLeft;
            var a = d.getY() - c.offsetTop;
            c.style.width = b + "px";
            c.style.height = a + "px";
            d.preventDefault()
        } else {
            return
        }
    },
    _docMouseUp: function (a) {
        var b = this;
        var d = a.getTarget();
        b._removeSelectionHelpers();
        if (d.tagName == "IMG") {
            b.imageButton.toggle(true);
            if ((b.wheelResize || b.dragResize) && (Ext.isWebKit || Ext.isOpera)) {
                d.setAttribute("iu_edit", "1")
            } else {
                d.setAttribute("iu_edit", "2")
            }
            if (Ext.isWebKit) {
                var c = this.cmp.getWin().getSelection ? this.cmp.getWin().getSelection() : this.cmp.getWin().document.selection;
                c.setBaseAndExtent(d, 0, d, 1)
            }
        } else {
            b.imageButton.toggle(false)
        }
    }
});
Ext.define("Deppon.form.HtmlEditor.ImageDialog", {
    extend: "Ext.window.Window",
    alternateClassName: "Ext.ux.form.HtmlEditor.ImageDialog",
    lang: null,
    lang: null,
    t: null,
    submitUrl: null,
    managerUrl: null,
    iframeDoc: null,
    pageSize: null,
    imageToEdit: "",
    closeAction: "destroy",
    width: 460,
    modal: true,
    resizable: false,
    relativePath: null,
    layout: {type: "fit"},
    title: "",
    listeners: {
        show: function (a) {
        }, resize: function (a) {
            a.center()
        }
    },
    initComponent: function () {
        var a = this;
        a.items = [{
            xtype: "form",
            name: "imageUploadForm",
            bodyPadding: 10,
            items: [{
                xtype: "filefield",
                buttonOnly: false,
                msgTarget: "side",
                readOnly: true,
                readOnlyCls: "disable",
                allowBlank: false,
                name: "file",
                anchor: "100%",
                buttonText: a.t("Upload Image...")
            }],
            dockedItems: [{
                xtype: "container",
                dock: "bottom",
                padding: 4,
                items: [{
                    xtype: "button",
                    style: {"float": "right"},
                    text: a.t("Cancel"),
                    handler: a.close,
                    scope: a
                }, {
                    xtype: "button",
                    style: {"float": "right", "margin-right": "8px"},
                    text: a.t("OK"),
                    formBind: true,
                    handler: a._uploadImage,
                    scope: a
                }]
            }]
        }];
        a.callParent(arguments);
        a.setTitle(a.t("Insert/Edit Image"))
    },
    getImage: function () {
        var a = this;
        var b = this.iframeDoc.createElement("img");
        b.setAttribute("src", a.managerUrl + "?relativePath=" + a.relativePath);
        return b
    },
    _deleteImage: function (d, b) {
        var c = this;
        if (!c.disableDelete) {
            Ext.Msg.show({
                title: c.t("Confirmation"),
                msg: c.t("Are you sure you want to delete this image?"),
                buttons: Ext.Msg.YESNO,
                closable: false,
                fn: function (a) {
                    if (a == "yes") {
                        Ext.Ajax.request({
                            url: c.managerUrl,
                            method: "POST",
                            params: {action: "delete", image: b.getAttribute ? b.getAttribute("img_fullname") : b},
                            success: function (f) {
                                var e = Ext.JSON.decode(f.responseText);
                                if (e.success) {
                                    var g = c.down("[name=src]");
                                    g.needsRefresh = true;
                                    g.setValue("");
                                    c.down("form").getForm().reset()
                                } else {
                                    Ext.Msg.alert(c.t("Error"), "Error: " + e.errors)
                                }
                            }
                        })
                    }
                }
            })
        }
    },
    _uploadImage: function (a) {
        var c = this;
        var b = a.up("form").getForm();
        if (b.isValid()) {
            b.submit({
                url: c.submitUrl + "?action=upload",
                waitMsg: c.t("Uploading your photo..."),
                success: function (d, e) {
                    c.relativePath = e.result.attachement.relativePath;
                    c.fireEvent("imageloaded")
                },
                failure: function (d, e) {
                    if (e.result) {
                        Ext.Msg.alert(c.t("Error"), "Error: " + e.result.errors)
                    }
                    c.down("[name=file]").reset()
                }
            })
        }
    },
    _serverAction: function (b) {
        var a = this;
        Ext.Ajax.request({
            url: a.managerUrl, method: "POST", params: b, success: function (d) {
                var c = Ext.JSON.decode(d.responseText);
                if (c.success) {
                    var e = a.down("[name=src]");
                    e.needsRefresh = true;
                    e.setRawValue(c.data.src)
                } else {
                    Ext.Msg.alert("Error", "Error: " + c.errors)
                }
            }
        })
    },
    _deleteImageClick: function () {
        var b = this;
        var c = b.down("[name=src]").getValue();
        var a = c.substring(c.lastIndexOf("/") + 1);
        b._deleteImage(null, a)
    }
});
Ext.define("Deppon.grid.column.LineBreak", {
    extend: "Ext.grid.column.Column",
    alias: "widget.linebreakcolumn",
    alternateClassName: ["Deppon.grid.LineBreakColumn"],
    initComponent: function () {
        var b = this, a = b.renderer;
        if (a) {
            b.renderer = function (g, e, c, h, f, d) {
                g = a(g, e, c, h, f, d);
                g = b.defaultRenderer(g, e, c, h, f, d);
                return g
            }
        }
        b.callParent(arguments)
    },
    defaultRenderer: function (e, c, a, f, d, b) {
        c.style = "white-space: normal; overflow: visible; word-break: break-all;";
        return e
    }
});
Ext.define("Deppon.form.field.MonthDateField", {
    extend: "Ext.form.field.Picker",
    alias: "widget.monthdatefield",
    format: "Y-m",
    altFormats: "m/y|m/Y|m-y|m-Y|my|mY|y/m|Y/m|y-m|Y-m|ym|Ym",
    triggerCls: Ext.baseCSSPrefix + "form-date-trigger",
    matchFieldWidth: false,
    startDay: new Date(),
    initComponent: function () {
        var a = this;
        a.disabledDatesRE = null;
        a.callParent()
    },
    initValue: function () {
        var a = this, b = a.value;
        if (Ext.isString(b)) {
            a.value = Ext.Date.parse(b, this.format)
        }
        if (a.value) {
            a.startDay = a.value
        }
        a.callParent()
    },
    rawToValue: function (a) {
        return Ext.Date.parse(a, this.format) || a || null
    },
    valueToRaw: function (a) {
        return this.formatDate(a)
    },
    formatDate: function (a) {
        return Ext.isDate(a) ? Ext.Date.dateFormat(a, this.format) : a
    },
    createPicker: function () {
        var a = this, b = Ext.String.format;
        return Ext.create("Ext.picker.Month", {
            cls: "c-monthpicker",
            pickerField: a,
            ownerCt: a.ownerCt,
            renderTo: document.body,
            floating: true,
            shadow: false,
            focusOnShow: true,
            listeners: {
                scope: a,
                cancelclick: a.onCancelClick,
                okclick: a.onOkClick,
                yeardblclick: a.onOkClick,
                monthdblclick: a.onOkClick
            }
        })
    },
    onExpand: function () {
        this.picker.setValue(this.startDay)
    },
    onOkClick: function (b, e) {
        var d = this, f = e[0], c = e[1], a = new Date(c, f, 1);
        d.startDay = a;
        d.setValue(a);
        this.picker.hide()
    },
    onCancelClick: function () {
        this.picker.hide()
    }
});
Ext.define("Deppon.grid.column.OpenTipWindow", {
    extend: "Ext.grid.column.Column",
    alias: "widget.opentipwindowcolumn",
    alternateClassName: "Deppon.grid.opentipwindowcolumn",
    windowClassName: null,
    openWindow: null,
    tipBodyElement: null,
    tipConfig: null,
    tipBody: null,
    tip: null,
    hasListener: false,
    getOpenWindow: function () {
        if (this.openWindow == null) {
            this.openWindow = Ext.create(this.windowClassName)
        }
        return this.openWindow
    },
    showOpenWindow: function (a, j, b, h, c, g, i, f, d) {
        if (this.windowClassName && (typeof this.getOpenWindow().bindData) != "undefined") {
            this.getOpenWindow().bindData(c, a)
        }
        this.getOpenWindow().show()
    },
    initComponent: function (b) {
        var c = this, a = c.renderer;
        if (a) {
            c.renderer = function (i, g, e, j, h, f, d) {
                i = a(i, g, e, j, h, f, d);
                i = c.defaultRenderer(i, g, e, j, h, f, d);
                return i
            }
        }
        c.defaultRenderer = function (n, k, f, j, g, o, l) {
            var h = this, d = h.up("gridpanel"), i = f.internalId + "-tip-openwindow-td";
            if (Ext.isEmpty(h.tipBody)) {
                if (!Ext.isEmpty(h.tipBodyElement)) {
                    h.tipBody = Ext.create(h.tipBodyElement)
                }
            }
            if (h.tip == null) {
                if (h.tipConfig == null) {
                    h.tipConfig = {}
                }
                if (!Ext.isEmpty(h.tipBody)) {
                    h.tipConfig.items = [h.tipBody]
                }
                h.tip = Ext.create("Ext.tip.ToolTip", h.tipConfig)
            }
            k.tdAttr = 'id="' + i + '"';
            if (!h.hasListener) {
                var e, m;
                if (o.getProxy().type == "ajax" || o.getProxy().type == "jsonp" || o.getProxy().type == "direct") {
                    e = o;
                    m = "load"
                } else {
                    e = l;
                    m = "refresh"
                }
                e.on(m, function () {
                    h.addMouseOverLis(n, k, f, o, l)
                });
                l.up("grid").on("sortchange", function () {
                    h.addMouseOverLis(n, k, f, o, l)
                });
                h.hasListener = true
            }
            if (h.windowClassName == null) {
                Ext.Error.raise("'windowClassName' of A property must configuration.")
            }
            d.on("cellclick", function (p, w, q, t, u, s, v, r) {
                if (w != null && w.className != null) {
                    if (w.className.indexOf("opentipwindowcolumn") != -1) {
                        h.showOpenWindow(d, p, w, q, t, u, s, v, r)
                    }
                }
            }, this);
            return Ext.String.format('<a href="javascript:void(0)">{0}</a>', n)
        };
        c.callParent(arguments)
    },
    addMouseOverLis: function (f, d, b, c, a) {
        var e = this;
        c.each(function (g, h, i) {
            var j = Ext.get(g.internalId + "-tip-openwindow-td");
            j.on("mouseover", function (m, l, k) {
                if (e.tipBody && (typeof e.tipBody.bindData) != "undefined") {
                    e.tipBody.bindData(g, f, d, c, a)
                }
                e.tip.showAt([m.browserEvent.pageX + 10, m.browserEvent.pageY + 10])
            })
        })
    }
});
Ext.define("Deppon.grid.column.OpenWindow", {
    extend: "Ext.grid.column.Column",
    alias: "widget.openwindowcolumn",
    alternateClassName: "Deppon.grid.OpenWindowColumn",
    windowClassName: null,
    openWindow: null,
    getOpenWindow: function () {
        if (this.openWindow == null) {
            this.openWindow = Ext.create(this.windowClassName)
        }
        return this.openWindow
    },
    showOpenWindow: function (a, j, b, h, c, g, i, f, d) {
        if (this.windowClassName && (typeof this.getOpenWindow().bindData) != "undefined") {
            this.getOpenWindow().bindData(c, a)
        }
        this.getOpenWindow().show()
    },
    initComponent: function (b) {
        var c = this, a = c.renderer;
        if (a) {
            c.renderer = function (h, f, d, i, g, e) {
                h = a(h, f, d, i, g, e);
                h = c.defaultRenderer(h, f, d, i, g, e);
                return h
            }
        }
        c.callParent(arguments)
    },
    defaultRenderer: function (g, d, a, h, e, b) {
        var f = this, c = f.up("gridpanel");
        if (f.windowClassName == null) {
            Ext.Error.raise("'windowClassName' of A property must configuration.")
        }
        c.on("cellclick", function (i, p, j, m, n, l, o, k) {
            if (p != null && p.className != null) {
                if (p.className.indexOf("openwindowcolumn") != -1) {
                    f.showOpenWindow(c, i, p, j, m, n, l, o, k)
                }
            }
        }, this);
        return Ext.String.format('<a href="javascript:void(0)">{0}</a>', g)
    }
});
Ext.define("Deppon.ux.PageSizePlugin", {
    alias: "plugin.pagesizeplugin",
    maximumSize: 200,
    limitWarning: "Can not exceed the maximum page size：",
    beforeText: "Each page display",
    afterText: "records",
    sizeList: [["10", 10], ["25", 25], ["50", 50], ["100", 100], ["200", 200]],
    constructor: function (a) {
        var b = this;
        Ext.apply(b, a)
    },
    init: function (a) {
        var b = this;
        b.combo = b.getPageSizeCombo(a);
        a.add(" ", b.beforeText, b.combo, b.afterText, " ");
        b.combo.on("select", b.onChangePageSize, b);
        b.combo.on("keypress", b.onKeyPress, b)
    },
    getPageSizeCombo: function (b) {
        var c = this, a = b.pageSize || b.store.pageSize || 25;
        return Ext.create("Ext.form.field.ComboBox", {
            store: new Ext.data.SimpleStore({
                fields: ["text", "value"],
                data: c.sizeList
            }),
            mode: "local",
            displayField: "text",
            valueField: "value",
            allowBlank: true,
            triggerAction: "all",
            width: 50,
            maskRe: /[0-9]/,
            enableKeyEvents: true,
            value: a
        })
    },
    onChangePageSize: function (d) {
        var c = d.up("standardpaging") || d.up("pagingtoolbar"), b = c.store, a = d.getValue();
        b.pageSize = a;
        b.loadPage(1)
    },
    onKeyPress: function (g, f) {
        if (Ext.isEmpty(g.getValue())) {
            return
        }
        var c = this, d = g.getValue(), b = c.combo.up("standardpaging") || c.combo.up("pagingtoolbar"), a = b.store;
        if (f.getKey() == f.ENTER) {
            if (d <= c.maximumSize) {
                a.pageSize = d;
                a.loadPage(1)
            } else {
                Ext.MessageBox.alert("Warning", c.limitWarning + c.maximumSize);
                g.setValue("")
            }
        }
    },
    destory: function () {
        var a = this;
        a.combo.clearListeners();
        Ext.destroy(a.combo);
        delete a.combo
    }
});
Ext.define("Deppon.selection.RadioModel", {
    alias: "selection.radiomodel",
    alternateClassName: "Ext.selection.RadioModel",
    extend: "Ext.selection.RowModel",
    mode: "SINGLE",
    injectRadio: 0,
    radioOnly: false,
    showHeaderRadio: false,
    headerWidth: 24,
    bindComponent: function (a) {
        var b = this;
        b.sortable = false;
        b.callParent(arguments);
        if (!b.hasLockedHeader() || a.headerCt.lockedCt) {
            b.addRadio(true);
            b.mon(a.ownerCt, "reconfigure", b.onReconfigure, b)
        }
    },
    hasLockedHeader: function () {
        var a = this.views, c = a.length, b;
        for (b = 0; b < c; b++) {
            if (a[b].headerCt.lockedCt) {
                return true
            }
        }
        return false
    },
    addRadio: function (c) {
        var d = this, b = d.injectRadio, a = d.views[0], e = a.headerCt;
        if (b !== false) {
            if (b == "first") {
                b = 0
            } else {
                if (b == "last") {
                    b = e.getColumnCount()
                }
            }
            Ext.suspendLayouts();
            e.add(b, d.getHeaderConfig());
            Ext.resumeLayouts()
        }
        if (c !== true) {
            a.refresh()
        }
    },
    onReconfigure: function (c, a, b) {
        if (b) {
            this.addRadio()
        }
    },
    getHeaderConfig: function () {
        var b = this, a = b.showHeaderRadio = false;
        return {
            isRadiorHd: a,
            text: "&#160;",
            width: b.headerWidth,
            sortable: false,
            draggable: false,
            resizable: false,
            hideable: false,
            menuDisabled: true,
            dataIndex: "",
            cls: "",
            renderer: Ext.Function.bind(b.renderer, b),
            editRenderer: b.editRenderer || b.renderEmpty,
            locked: b.hasLockedHeader()
        }
    },
    renderEmpty: function () {
        return "&#160;"
    },
    renderer: function (g, c, b, h, e, d, a) {
        var f = Ext.baseCSSPrefix;
        c.tdCls = f + "grid-cell-special " + f + "grid-cell-row-radio";
        return '<div class="' + f + 'grid-row-radio">&#160;</div>'
    },
    onRowMouseDown: function (c, b, g, d, h) {
        c.el.focus();
        var f = this, a = h.getTarget("." + Ext.baseCSSPrefix + "grid-row-radio"), i;
        if (!f.allowRightMouseSelection(h)) {
            return
        }
        if (f.radioOnly && !a) {
            return
        }
        if (a) {
            i = f.getSelectionMode();
            if (i !== "SINGLE") {
                f.setSelectionMode("SINGLE")
            }
            f.selectWithEvent(b, h);
            f.setSelectionMode(i)
        } else {
            f.selectWithEvent(b, h)
        }
    }
});
Ext.define("Deppon.form.field.RangeDateField", {
    extend: "Ext.form.FieldContainer",
    alias: ["widget.rangeDateField", "widget.rangedatefield"],
    alternateClassName: ["Deppon.form.RangeDateField"],
    dateType: "datefield",
    fromName: "",
    toName: "",
    showDefaultFlag: true,
    fromValue: "",
    toValue: "",
    dateRange: 0,
    time: true,
    increment: 30,
    fieldId: "",
    allowFromBlank: true,
    allowToBlank: true,
    disallowBlank: false,
    fromEditable: true,
    toEditable: true,
    editable: true,
    rangeFlag: "&nbsp;&nbsp;To&nbsp;&nbsp;",
    initComponent: function () {
        var a = this;
        a.layout = "column";
        a.initContainer();
        a.callParent(arguments);
        if (a.showDefaultFlag) {
            a.on("boxready", this.setDefaultValue, this, {single: true})
        }
    },
    initContainer: function () {
        var e = this, d, c, a, b, f, g;
        e.dateType = e.dateType || "datefield";
        if (e.disallowBlank) {
            e.allowFromBlank = false;
            e.allowToBlank = false
        }
        if (!e.editable) {
            e.fromEditable = false;
            e.toEditable = false
        }
        d = {
            itemId: "first",
            xtype: e.dateType,
            name: e.fromName,
            allowBlank: e.allowFromBlank,
            editable: e.fromEditable,
            columnWidth: 0.5
        };
        c = {xtype: "label", html: e.rangeFlag, style: {textAlign: "center", marginTop: "5px"}};
        a = {
            itemId: "second",
            xtype: e.dateType,
            name: e.toName,
            allowBlank: e.allowToBlank,
            editable: e.toEditable,
            columnWidth: 0.5
        };
        g = typeof(e.dateRange) == "number" && e.dateRange != 0;
        switch (e.dateType) {
            case"my97datetimefield":
            case"datetimefield_date97":
                e.fieldId = e.fieldId || "";
                b = g ? {
                    el: e.fieldId + "_first-inputEl",
                    startDate: e.fromValue,
                    errDealMode: 1,
                    maxDate: "#F{$dp.$D('" + e.fieldId + "_second-inputEl')}",
                    minDate: "#F{$dp.$D('" + e.fieldId + "_second-inputEl', {d: -" + e.dateRange + "})}"
                } : {
                    el: e.fieldId + "_first-inputEl",
                    startDate: e.fromValue,
                    errDealMode: 1,
                    maxDate: "#F{$dp.$D('" + e.fieldId + "_second-inputEl')}"
                };
                f = g ? {
                    el: e.fieldId + "_second-inputEl",
                    startDate: e.toValue,
                    errDealMode: 1,
                    minDate: "#F{$dp.$D('" + e.fieldId + "_first-inputEl')}",
                    maxDate: "#F{$dp.$D('" + e.fieldId + "_first-inputEl', {d: " + e.dateRange + "})}"
                } : {
                    el: e.fieldId + "_second-inputEl",
                    startDate: e.toValue,
                    errDealMode: 1,
                    minDate: "#F{$dp.$D('" + e.fieldId + "_first-inputEl')}"
                };
                Ext.apply(d, {id: e.fieldId + "_first", time: e.time, dateConfig: b});
                Ext.apply(a, {id: e.fieldId + "_second", time: e.time, dateConfig: f});
                break;
            case"datefield":
                e.format = e.format || "Y-m-d";
                Ext.apply(d, {
                    format: e.format, value: e.fromValue, listeners: {
                        select: {
                            fn: function (j, h) {
                                j.up().child("#second").setMinValue(h);
                                if (g) {
                                    var i = Ext.Date.add(h, Ext.Date.DAY, e.dateRange);
                                    j.up().child("#second").setMaxValue(i)
                                }
                            }
                        }, scope: e
                    }
                });
                Ext.apply(a, {
                    format: e.format, value: e.toValue, listeners: {
                        select: {
                            fn: function (j, i) {
                                j.up().child("#first").setMaxValue(i);
                                if (g) {
                                    var h = Ext.Date.add(i, Ext.Date.DAY, e.dateRange);
                                    j.up().child("#first").setMaxValue(h)
                                }
                            }
                        }
                    }
                });
                break;
            case"timefield":
                e.increment = e.increment || 30;
                e.format = e.format || "H: i";
                Ext.apply(d, {
                    format: e.format,
                    value: e.fromValue,
                    increment: e.increment,
                    listeners: {
                        select: {
                            fn: function (i, h) {
                                i.up().child("#second").setMinValue(h)
                            }
                        }
                    }
                });
                Ext.apply(a, {
                    format: e.format,
                    value: e.toValue,
                    increment: e.increment,
                    listeners: {
                        select: {
                            fn: function (i, h) {
                                i.up().child("#first").setMaxValue(h)
                            }
                        }
                    }
                })
        }
        e.items = [d, c, a]
    },
    setDefaultValue: function () {
        var a = this;
        if (a.dateType == "my97datetimefield" || a.dateType == "datetimefield_date97") {
            if (!Ext.isEmpty(a.fromValue)) {
                Ext.get(a.fieldId + "_first-inputEl").dom.value = a.fromValue
            }
            if (!Ext.isEmpty(a.toValue)) {
                Ext.get(a.fieldId + "_second-inputEl").dom.value = a.toValue
            }
        }
    }
});
Ext.define("Deppon.grid.plugin.RowExpander", {
    extend: "Ext.AbstractPlugin",
    requires: ["Ext.grid.feature.RowBody", "Ext.grid.feature.RowWrap"],
    alias: "plugin.rowexpander",
    alternateClassName: ["Deppon.grid.RowExpander"],
    rowBodyTpl: null,
    rowsExpander: true,
    expandOnEnter: true,
    expandOnDblClick: true,
    header: false,
    rowBodyElement: null,
    beforeRowIndex: null,
    elementIdMap: null,
    rowBodyTrSelector: ".x-grid-rowbody-tr",
    rowBodyHiddenCls: "x-grid-row-body-hidden",
    rowCollapsedCls: "x-grid-row-collapsed",
    getRowBodyElement: function (a) {
        if (this.rowBodyElement == null || Ext.isEmpty(a)) {
            return
        }
        return this.elementIdMap.get(a.internalId + "-rowbody-element")
    },
    getExpendRow: function () {
        if (this.rowBodyElement == null) {
            return
        }
        var a = this.view, b = a.getNodes();
        expendRows = new Array();
        for (var c = 0; c < b.length; c++) {
            var d = b[c], e = Ext.get(d);
            if (!e.hasCls(this.rowCollapsedCls)) {
                expendRows.push(e)
            }
        }
        if (this.rowsExpander == false) {
            if (expendRows.length == 1) {
                return expendRows[0]
            } else {
                return null
            }
        }
        return expendRows
    },
    getRowRecord: function (c) {
        if (this.rowBodyElement == null || Ext.isEmpty(c)) {
            return
        }
        var b = this.view, a = this.view.getRecord(c);
        return a
    },
    getExpendRowBody: function () {
        var c = this.getExpendRow(), e = new Array();
        if (this.rowsExpander == false) {
            var b = this.getRowRecord(c);
            var a = this.getRowBodyElement(b);
            return a
        }
        for (var d = 0; d < c.length; d++) {
            var b = this.getRowRecord(c[d]);
            var a = this.getRowBodyElement(b);
            e.push(a)
        }
        return e
    },
    renderer: function (d, b, a, c, e) {
        if (e === 0) {
            b.tdCls = "x-grid-td-expander"
        }
        return '<div class="x-grid-row-expander">&#160;</div>'
    },
    constructor: function () {
        this.callParent(arguments);
        this.elementIdMap = new Ext.util.HashMap();
        var b = this.getCmp();
        this.recordsExpanded = {};
        if (!this.rowBodyTpl && !this.rowBodyElement) {
            Ext.Error.raise("'rowBodyTpl' and 'rowBodyElement' of A property must configuration.")
        }
        var c = null;
        if (this.rowBodyTpl) {
            var a = Ext.create("Ext.XTemplate", this.rowBodyTpl);
            c = [{
                ftype: "rowbody",
                rowBodyTpl: this.rowBodyTpl,
                columnId: this.getHeaderId(),
                recordsExpanded: this.recordsExpanded,
                rowBodyHiddenCls: this.rowBodyHiddenCls,
                rowCollapsedCls: this.rowCollapsedCls,
                getAdditionalData: this.getRowBodyFeatureData,
                getRowBodyContents: function (d) {
                    return a.applyTemplate(d)
                }
            }, {ftype: "rowwrap"}]
        }
        if (this.rowBodyElement) {
            c = [{
                ftype: "rowbody",
                rowBodyElement: this.rowBodyElement,
                columnId: this.getHeaderId(),
                recordsExpanded: this.recordsExpanded,
                rowBodyHiddenCls: this.rowBodyHiddenCls,
                rowCollapsedCls: this.rowCollapsedCls,
                getAdditionalData: this.getRowBodyFeatureData,
                getRowBodyContents: function (d) {
                    return "<div id='" + d + "' class='x-row-embedded'></div>"
                }
            }, {ftype: "rowwrap"}]
        }
        if (b.features) {
            b.features = c.concat(b.features)
        } else {
            b.features = c
        }
    },
    init: function (a) {
        var b = this;
        this.callParent(arguments);
        if (this.header) {
            a.headerCt.insert(0, this.getHeaderConfig())
        }
        a.on("render", this.bindView, this, {single: true});
        a.getView().on("refresh", function (c, d) {
            b.cleanElementIdMap()
        }, this)
    },
    cleanElementIdMap: function () {
        if (this.elementIdMap == null) {
            return
        }
        var a = this.view, d = a.store;
        for (var b = 0; b < d.data.length; b++) {
            rowIdx = d.getAt(b), rowNode = a.getNode(rowIdx), row = Ext.get(rowNode);
            if (row != null && !row.hasCls(this.rowCollapsedCls)) {
                row.addCls(this.rowCollapsedCls)
            }
        }
        if (this.elementIdMap.length == 0) {
            return
        }
        for (var c = 0; c < this.elementIdMap.getKeys().length; c++) {
            cleanComponent(this.elementIdMap.getValues()[c]);
            var e = Ext.ComponentManager.get(this.elementIdMap.getKeys()[c] + "_header");
            cleanComponent(e);
            Ext.ComponentManager.unregister(e);
            e = null
        }
        this.elementIdMap.clear();
        this.beforeRowIndex = null
    },
    getHeaderId: function () {
        if (!this.headerId) {
            this.headerId = Ext.id()
        }
        return this.headerId
    },
    getRowBodyFeatureData: function (d, a, c, g, b) {
        var e = Ext.grid.feature.RowBody.prototype.getAdditionalData.apply(this, arguments), f = this.columnId;
        e.rowBodyColspan = e.rowBodyColspan;
        if (this.rowBodyTpl) {
            e.rowBody = this.getRowBodyContents(d)
        }
        if (this.rowBodyElement) {
            e.rowBody = this.getRowBodyContents(c.internalId + "-rowbody")
        }
        e.rowCls = this.recordsExpanded[c.internalId] ? "" : this.rowCollapsedCls;
        e.rowBodyCls = this.recordsExpanded[c.internalId] ? "" : this.rowBodyHiddenCls;
        e[f + "-tdAttr"] = ' valign="top" rowspan="1" height="28" ';
        if (g[f + "-tdAttr"]) {
            e[f + "-tdAttr"] += g[f + "-tdAttr"]
        }
        return e
    },
    bindView: function () {
        var a = this.getCmp().getView(), b;
        if (!a.rendered) {
            a.on("render", this.bindView, this, {single: true})
        } else {
            b = a.getEl();
            if (this.expandOnEnter) {
                this.keyNav = Ext.create("Ext.KeyNav", b, {enter: this.onEnter, scope: this})
            }
            if (this.expandOnDblClick) {
                a.on("itemdblclick", this.onDblClick, this)
            }
            this.view = a
        }
    },
    onEnter: function (h) {
        var b = this.view, g = b.store, j = b.getSelectionModel(), a = j.getSelection(), f = a.length, c = 0, d;
        for (; c < f; c++) {
            d = g.indexOf(a[c]);
            this.toggleRow(d)
        }
    },
    toggleRow: function (c) {
        if (!this.rowsExpander) {
            if (this.beforeRowIndex != null && this.beforeRowIndex != c) {
                var l = this.view.getNode(this.beforeRowIndex), j = Ext.get(l), e = Ext.get(j).down(this.rowBodyTrSelector), g = this.view.getRecord(l);
                j.addCls(this.rowCollapsedCls);
                e.addCls(this.rowBodyHiddenCls);
                if (g != null) {
                    this.recordsExpanded[g.internalId] = false;
                    this.view.fireEvent("collapsebody", l, g, e.dom)
                }
            }
            this.beforeRowIndex = c
        }
        var d = this.view.getNode(c), n = Ext.get(d), k = Ext.get(n).down(this.rowBodyTrSelector), i = this.view.getRecord(d), b = this.getCmp(), a = i.internalId + "-rowbody", m = i.internalId + "-rowbody-element";
        if (n.hasCls(this.rowCollapsedCls)) {
            n.removeCls(this.rowCollapsedCls);
            k.removeCls(this.rowBodyHiddenCls);
            this.recordsExpanded[i.internalId] = true;
            this.view.fireEvent("expandbody", d, i, k.dom);
            if (this.rowBodyElement && !this.elementIdMap.containsKey(m)) {
                var h = Ext.create(this.rowBodyElement, {id: m});
                Ext.Object.merge(h, {superGrid: b, record: i});
                if (h && (typeof h.setTipData) != "undefined") {
                    h.setTipData(i)
                }
                h.on("resize", function (r, q, o, p) {
                    r.getEl().on("DOMSubtreeModified", function (v, u, s) {
                        var w = Ext.get(u);
                        var t = w.select("table." + Ext.baseCSSPrefix + "grid-table-resizer");
                        t.each(function (y, z, x) {
                            if (y.hasCls(Ext.baseCSSPrefix + "grid-table-resizer")) {
                                y.removeCls(Ext.baseCSSPrefix + "grid-table-resizer")
                            }
                        })
                    })
                });
                h.render(a);
                this.elementIdMap.add(h.id, h)
            }
            var h = this.elementIdMap.get(m);
            if (h && (typeof h.bindData) != "undefined") {
                h.bindData(i, b, h)
            }
        } else {
            n.addCls(this.rowCollapsedCls);
            k.addCls(this.rowBodyHiddenCls);
            this.recordsExpanded[i.internalId] = false;
            this.view.fireEvent("collapsebody", d, i, k.dom);
            var h = this.elementIdMap.get(m);
            if (h && (typeof h.unbindData) != "undefined") {
                h.unbindData(i, b, h)
            }
        }
        var f = b.up("tabpanel");
        if (f) {
            f.doComponentLayout()
        }
    },
    onDblClick: function (b, a, d, c, f) {
        this.toggleRow(d)
    },
    getHeaderConfig: function () {
        var c = this, b = Ext.Function.bind(c.onDblClick, c), a = c.selectRowOnExpand;
        return {
            id: this.getHeaderId(),
            width: 24,
            sortable: false,
            resizable: false,
            draggable: false,
            hideable: false,
            menuDisabled: true,
            cls: Ext.baseCSSPrefix + "grid-header-special",
            renderer: function (e, d) {
                d.tdCls = Ext.baseCSSPrefix + "grid-cell-special";
                return '<div class="' + Ext.baseCSSPrefix + 'grid-row-expander">&#160;</div>'
            },
            processEvent: function (i, f, d, g, h, j) {
                if (i == "mousedown" && j.getTarget(".x-grid-row-expander")) {
                    var k = j.getTarget(".x-grid-row");
                    b(f, d, k, g, j);
                    return a
                }
            }
        }
    }
});
Ext.define("Deppon.paging.SimplePaging", {
    extend: "Ext.toolbar.Toolbar",
    alias: "widget.simplepaging",
    alternateClassName: ["Deppon.SimplePaging"],
    mixins: {bindable: "Ext.util.Bindable"},
    prependButtons: false,
    displayMsg: "Displaying {0}",
    emptyMsg: "No data to display",
    prevText: "Previous Page",
    nextText: "Next Page",
    getPagingItems: function () {
        var a = this;
        return ["->", {xtype: "tbtext", itemId: "displayItem"}, {
            itemId: "prev",
            tooltip: a.prevText,
            overflowText: a.prevText,
            iconCls: "deppon_icons_tbarpaging_pre",
            disabled: true,
            handler: a.movePrevious,
            scope: a
        }, {
            itemId: "next",
            tooltip: a.nextText,
            overflowText: a.nextText,
            iconCls: "deppon_icons_tbarpaging_next",
            disabled: true,
            handler: a.moveNext,
            scope: a
        }]
    },
    initComponent: function () {
        var b = this, c = b.getPagingItems(), a = b.items || b.buttons || [];
        if (b.prependButtons) {
            b.items = a.concat(c)
        } else {
            b.items = c.concat(a)
        }
        delete b.buttons;
        b.callParent();
        b.addEvents("change", "beforechange");
        b.on("beforerender", b.onLoad, b, {single: true});
        b.bindStore(b.store || "ext-empty-store", true)
    },
    updateInfo: function () {
        var e = this, a = e.store, c = e.getPageData(), b = e.child("#displayItem"), d, f;
        if (b) {
            d = a.getCount();
            if (d === 0) {
                f = e.emptyMsg
            } else {
                f = Ext.String.format(e.displayMsg, c.pageCount)
            }
            b.setText(f)
        }
    },
    onLoad: function () {
        var f = this, d, b, c, a, e, g;
        e = f.store.getCount();
        g = e === 0;
        if (!g) {
            d = f.getPageData();
            b = d.currentPage;
            c = d.pageCount
        } else {
            b = 0;
            c = 0
        }
        Ext.suspendLayouts();
        f.child("#prev").setDisabled(b === 1 || g);
        f.child("#next").setDisabled(b === c || g);
        f.updateInfo();
        Ext.resumeLayouts(true);
        if (f.rendered) {
            f.fireEvent("change", f, d)
        }
    },
    getPageData: function () {
        var b = this.store, a = b.getTotalCount();
        return {
            total: a,
            currentPage: b.currentPage,
            pageCount: Math.ceil(a / b.pageSize),
            fromRecord: ((b.currentPage - 1) * b.pageSize) + 1,
            toRecord: Math.min(b.currentPage * b.pageSize, a)
        }
    },
    movePrevious: function () {
        var b = this, a = b.store.currentPage - 1;
        if (a > 0) {
            if (b.fireEvent("beforechange", b, a) !== false) {
                b.store.previousPage()
            }
        }
    },
    moveNext: function () {
        var c = this, b = c.getPageData().pageCount, a = c.store.currentPage + 1;
        if (a <= b) {
            if (c.fireEvent("beforechange", c, a) !== false) {
                c.store.nextPage()
            }
        }
    },
    getStoreListeners: function () {
        return {load: this.onLoad}
    },
    unbind: function (a) {
        this.bindStore(null)
    },
    bind: function (a) {
        this.bindStore(a)
    },
    onDestroy: function () {
        this.unbind();
        this.callParent()
    }
});
Ext.define("Deppon.paging.StandardPaging", {
    extend: "Ext.toolbar.Toolbar",
    alias: "widget.standardpaging",
    alternateClassName: ["Deppon.StandardPaging"],
    mixins: {bindable: "Ext.util.Bindable"},
    randomId: 0,
    cls: "depponPaging",
    prependButtons: false,
    totalCountFlag: false,
    displayMsg: "Total: {0} page(s)",
    displayExtralMsg: "Total: {0} page(s), {1} records",
    emptyMsg: "No data to display",
    firstText: "First Page",
    prevText: "Previous Page",
    nextText: "Next Page",
    lastText: "Last Page",
    getPagingItems: function () {
        return ["->", {xtype: "tbtext", baseCls: "x-standardpaging-total", itemId: "displayItem"}]
    },
    initComponent: function () {
        var b = this, c = b.getPagingItems(), a = b.items || b.buttons || [];
        b.randomId = Math.random();
        if (b.prependButtons) {
            b.items = a.concat(c)
        } else {
            b.items = c.concat(a)
        }
        delete b.buttons;
        b.callParent();
        b.addEvents("change", "beforechange");
        b.on("beforerender", b.onLoad, b, {single: true});
        b.bindStore(b.store || "ext-empty-store", true)
    },
    updateInfo: function () {
        var e = this, c = e.child("#displayItem"), a = e.store, b = e.getPageData(), d, f;
        if (c) {
            d = a.getCount();
            if (d === 0) {
                f = e.emptyMsg
            } else {
                if (!e.totalCountFlag) {
                    f = Ext.String.format(e.displayMsg, b.pageCount)
                } else {
                    f = Ext.String.format(e.displayExtralMsg, b.pageCount, b.total)
                }
            }
            c.setText(f)
        }
    },
    createPageView: function (d, e) {
        var g = this, f = g.store.getTotalCount(), b = Math.ceil(f / g.store.pageSize);
        for (var c = 0; c < d.length; c++) {
            var a = Ext.get("pageItem_" + g.randomId + "_" + c);
            if (a) {
                a.removeCls("deppon-paging-item-visible");
                a.addCls("deppon-paging-item-display");
                a.dom.innerHTML = (d[c] == "") ? "" : (d[c]);
                if (d[c] != "" && d[c] != "..." && d[c] != e) {
                    a.dom.style.color = "#385F95";
                    a.dom.style.display = "block";
                    a.dom.style.cursor = "pointer";
                    if ((d[c] == "首页" && e == 1) || (d[c] == "上一页" && e == 1) || (d[c] == "下一页" && e == b) || (d[c] == "尾页" && e == b)) {
                        a.dom.style.cursor = "default";
                        a.dom.style.color = "#000000"
                    }
                } else {
                    a.dom.style.cursor = "default";
                    a.dom.style.display = "block";
                    if (d[c] == e) {
                        a.dom.style.color = "#000000"
                    } else {
                        if (d[c] == "...") {
                            a.dom.style.color = "#385F95"
                        } else {
                            if (d[c] == "") {
                                a.dom.style.display = "none"
                            }
                        }
                    }
                }
                a.removeAllListeners();
                if (d[c] == "..." || d[c] == "" || d[c] == e) {
                    a.on("click", function () {
                    })
                } else {
                    if (typeof(d[c]) == "number") {
                        a.on("click", function (j, h) {
                            var i = parseInt(h.textContent || h.innerText);
                            if (g.fireEvent("beforechange", g, i) !== false) {
                                g.store.loadPage(i)
                            }
                        }, this, {single: true})
                    } else {
                        if (d[c] == "首页") {
                            if (e != 1) {
                                a.on("click", g.moveFirst, g)
                            }
                        } else {
                            if (d[c] == "上一页") {
                                a.on("click", g.movePrevious, g)
                            } else {
                                if (d[c] == "下一页") {
                                    a.on("click", g.moveNext, g)
                                } else {
                                    if (d[c] == "尾页") {
                                        if (e != b) {
                                            a.on("click", g.moveLast, g)
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    getPageList: function (a) {
        var e = this, b = e.store, d = a;
        totalCount = b.getTotalCount(), pageCount = Math.ceil(totalCount / b.pageSize), pageList = [];
        if (pageCount <= 7) {
            for (var c = 0; c < 13; c++) {
                if (c == 0) {
                    pageList.push("首页")
                } else {
                    if (c == 1) {
                        pageList.push("上一页")
                    }
                    if (c <= pageCount) {
                        pageList.push(c)
                    } else {
                        if (c == pageCount + 1) {
                            pageList.push("下一页")
                        } else {
                            if (c == pageCount + 2) {
                                pageList.push("尾页")
                            } else {
                                if (c > pageCount + 2) {
                                    pageList.push("")
                                }
                            }
                        }
                    }
                }
            }
        } else {
            if (d <= 5) {
                for (var c = 0; c < 13; c++) {
                    if (c == 0) {
                        pageList.push("首页")
                    } else {
                        if (c == 1) {
                            pageList.push("上一页")
                        }
                        if (c < 8) {
                            pageList.push(c)
                        } else {
                            if (c == 9) {
                                pageList.push("...")
                            } else {
                                if (c == 10) {
                                    pageList.push(pageCount)
                                } else {
                                    if (c == 11) {
                                        pageList.push("下一页")
                                    } else {
                                        if (c == 12) {
                                            pageList.push("尾页")
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            } else {
                if (d > 5 && d < (pageCount - 4)) {
                    for (var c = 0; c < 13; c++) {
                        if (c == 0) {
                            pageList.push("首页")
                        } else {
                            if (c == 1) {
                                pageList.push("上一页")
                            } else {
                                if (c == 2) {
                                    pageList.push(1)
                                } else {
                                    if (c == 3 || c == 9) {
                                        pageList.push("...")
                                    } else {
                                        if (c > 3 && c < 9) {
                                            pageList.push(d - (6 - c))
                                        } else {
                                            if (c == 10) {
                                                pageList.push(pageCount)
                                            } else {
                                                if (c == 11) {
                                                    pageList.push("下一页")
                                                } else {
                                                    if (c == 12) {
                                                        pageList.push("尾页")
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                } else {
                    if (d >= (pageCount - 4)) {
                        for (var c = 0; c < 13; c++) {
                            if (c == 0) {
                                pageList.push("首页")
                            } else {
                                if (c == 1) {
                                    pageList.push("上一页")
                                } else {
                                    if (c == 2) {
                                        pageList.push(1)
                                    } else {
                                        if (c == 3) {
                                            pageList.push("...")
                                        } else {
                                            if (c > 3 && c < 11) {
                                                pageList.push(pageCount - (10 - c))
                                            } else {
                                                if (c == 11) {
                                                    pageList.push("下一页")
                                                } else {
                                                    if (c == 12) {
                                                        pageList.push("尾页")
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        e.createPageView(pageList, d)
    },
    onLoad: function () {
        var f = this, d, b, e, a, g;
        e = f.store.getCount();
        b = f.store.currentPage;
        a = f.store.getTotalCount();
        g = e === 0;
        if (!g) {
            d = f.getPageData()
        } else {
            if (a > 0 && b > 1) {
                f.store.loadPage(b - 1);
                b = 0
            } else {
                b = 0
            }
        }
        Ext.suspendLayouts();
        f.updateInfo();
        if (b != 0) {
            f.getPageList(b)
        } else {
            for (var c = 0; c < 13; c++) {
                if (Ext.fly("pageItem_" + f.randomId + "_" + c)) {
                    Ext.fly("pageItem_" + f.randomId + "_" + c).dom.style.display = "none"
                } else {
                    f.add({
                        tag: "span",
                        type: "text",
                        cls: "deppon-paging-item-visible",
                        id: "pageItem_" + f.randomId + "_" + c
                    })
                }
            }
        }
        Ext.resumeLayouts(true);
        if (f.rendered) {
            f.fireEvent("change", f, d)
        }
    },
    getPageData: function () {
        var b = this.store, a = b.getTotalCount();
        return {
            total: a,
            currentPage: b.currentPage,
            pageCount: Math.ceil(a / b.pageSize),
            fromRecord: ((b.currentPage - 1) * b.pageSize) + 1,
            toRecord: Math.min(b.currentPage * b.pageSize, a)
        }
    },
    moveFirst: function () {
        var a = this;
        if (a.fireEvent("beforechange", a, 1) !== false) {
            a.store.loadPage(1)
        }
    },
    movePrevious: function () {
        var b = this, a = b.store.currentPage - 1;
        if (a > 0) {
            if (b.fireEvent("beforechange", b, a) !== false) {
                b.store.previousPage()
            }
        }
    },
    moveNext: function () {
        var c = this, b = c.getPageData().pageCount, a = c.store.currentPage + 1;
        if (a <= b) {
            if (c.fireEvent("beforechange", c, a) !== false) {
                c.store.nextPage()
            }
        }
    },
    moveLast: function () {
        var b = this, a = b.getPageData().pageCount;
        if (b.fireEvent("beforechange", b, a) !== false) {
            b.store.loadPage(a)
        }
    },
    beforeLoad: function () {
        var d = this, c = d.up("grid");
        if (c != undefined && c.getSelectionModel().getSelectionMode() === "MULTI") {
            var f = c.getSelectionModel(), a = f.views[0], b, e;
            if (a) {
                e = a.headerCt;
                if (e) {
                    b = e.child("gridcolumn[isCheckerHd]");
                    if (b && b.el) {
                        if (b.el.hasCls("x-grid-hd-checker-on")) {
                            b.el.removeCls("x-grid-hd-checker-on")
                        }
                    }
                }
            }
        }
    },
    getStoreListeners: function () {
        return {beforeload: this.beforeLoad, load: this.onLoad}
    },
    unbind: function (a) {
        this.bindStore(null)
    },
    bind: function (a) {
        this.bindStore(a)
    },
    onDestroy: function () {
        this.unbind();
        this.callParent()
    }
});
Ext.define("Deppon.tab.TabCloseMenu", {
    alias: "plugin.tabclosemenu",
    mixins: {observable: "Ext.util.Observable"},
    closeTabText: "Close Tab",
    showCloseOthers: true,
    closeOthersTabsText: "Close Other Tabs",
    showCloseAll: true,
    closeAllTabsText: "Close All Tabs",
    extraItemsHead: null,
    extraItemsTail: null,
    constructor: function (a) {
        this.addEvents("aftermenu", "beforemenu");
        this.mixins.observable.constructor.call(this, a)
    },
    init: function (a) {
        this.tabPanel = a;
        this.tabBar = a.down("tabbar");
        this.mon(this.tabPanel, {scope: this, afterlayout: this.onAfterLayout, single: true})
    },
    onAfterLayout: function () {
        this.mon(this.tabBar.el, {scope: this, contextmenu: this.onContextMenu, delegate: "div.x-tab"})
    },
    onBeforeDestroy: function () {
        Ext.destroy(this.menu);
        this.callParent(arguments)
    },
    onContextMenu: function (d, f) {
        var c = this, g = c.createMenu(), e = true, h = true, b = c.tabBar.getChildByElement(f), a = c.tabBar.items.indexOf(b);
        c.item = c.tabPanel.getComponent(a);
        g.child('*[text="' + c.closeTabText + '"]').setDisabled(!c.item.closable);
        if (c.showCloseAll || c.showCloseOthers) {
            c.tabPanel.items.each(function (i) {
                if (i.closable) {
                    e = false;
                    if (i != c.item) {
                        h = false;
                        return false
                    }
                }
                return true
            });
            if (c.showCloseAll) {
                g.child('*[text="' + c.closeAllTabsText + '"]').setDisabled(e)
            }
            if (c.showCloseOthers) {
                g.child('*[text="' + c.closeOthersTabsText + '"]').setDisabled(h)
            }
        }
        d.preventDefault();
        c.fireEvent("beforemenu", g, c.item, c);
        g.showAt(d.getXY())
    },
    createMenu: function () {
        var b = this;
        if (!b.menu) {
            var a = [{text: b.closeTabText, scope: b, handler: b.onClose}];
            if (b.showCloseOthers) {
                a.push({text: b.closeOthersTabsText, scope: b, handler: b.onCloseOthers})
            }
            if (b.showCloseAll) {
                a.push({text: b.closeAllTabsText, scope: b, handler: b.onCloseAll})
            }
            if (b.extraItemsHead) {
                a = b.extraItemsHead.concat(a)
            }
            if (b.extraItemsTail) {
                a = a.concat(b.extraItemsTail)
            }
            b.menu = Ext.create("Ext.menu.Menu", {items: a, listeners: {hide: b.onHideMenu, scope: b}})
        }
        return b.menu
    },
    onHideMenu: function () {
        var a = this;
        a.item = null;
        a.fireEvent("aftermenu", a.menu, a)
    },
    onClose: function () {
        this.tabPanel.remove(this.item)
    },
    onCloseOthers: function () {
        this.doClose(true)
    },
    onCloseAll: function () {
        this.doClose(false)
    },
    doClose: function (b) {
        var a = [];
        this.tabPanel.items.each(function (c) {
            if (c.closable) {
                if (!b || c != this.item) {
                    a.push(c)
                }
            }
        }, this);
        Ext.each(a, function (c) {
            this.tabPanel.remove(c)
        }, this)
    }
});
Ext.define("Deppon.tab.TabScrollerMenu", {
    alias: "plugin.tabscrollermenu",
    uses: ["Ext.menu.Menu"],
    pageSize: 10,
    maxText: 15,
    menuPrefixText: "Items",
    constructor: function (a) {
        a = a || {};
        Ext.apply(this, a)
    },
    init: function (b) {
        var a = this;
        Ext.apply(b, a.parentOverrides);
        a.tabPanel = b;
        b.on({
            render: function () {
                a.tabBar = b.tabBar;
                a.layout = a.tabBar.layout;
                a.layout.overflowHandler.handleOverflow = Ext.Function.bind(a.showButton, a);
                a.layout.overflowHandler.clearOverflow = Ext.Function.createSequence(a.layout.overflowHandler.clearOverflow, a.hideButton, a)
            }, single: true
        })
    },
    showButton: function () {
        var b = this, a = Ext.getClass(b.layout.overflowHandler).prototype.handleOverflow.apply(b.layout.overflowHandler, arguments);
        if (!b.menuButton) {
            b.menuButton = b.tabBar.body.createChild({cls: Ext.baseCSSPrefix + "tab-tabmenu-right"}, b.tabBar.body.child("." + Ext.baseCSSPrefix + "box-scroller-right"));
            b.menuButton.addClsOnOver(Ext.baseCSSPrefix + "tab-tabmenu-over");
            b.menuButton.on("click", b.showTabsMenu, b)
        }
        b.menuButton.show();
        a.reservedSpace += b.menuButton.getWidth();
        return a
    },
    hideButton: function () {
        var a = this;
        if (a.menuButton) {
            a.menuButton.hide()
        }
    },
    getPageSize: function () {
        return this.pageSize
    },
    setPageSize: function (a) {
        this.pageSize = a
    },
    getMaxText: function () {
        return this.maxText
    },
    setMaxText: function (a) {
        this.maxText = a
    },
    getMenuPrefixText: function () {
        return this.menuPrefixText
    },
    setMenuPrefixText: function (a) {
        this.menuPrefixText = a
    },
    showTabsMenu: function (d) {
        var a = this;
        if (a.tabsMenu) {
            a.tabsMenu.removeAll()
        } else {
            a.tabsMenu = Ext.create("Ext.menu.Menu");
            a.tabPanel.on("destroy", a.tabsMenu.destroy, a.tabsMenu)
        }
        a.generateTabMenuItems();
        var c = Ext.get(d.getTarget());
        var b = c.getXY();
        b[1] += 24;
        a.tabsMenu.showAt(b)
    },
    generateTabMenuItems: function () {
        var j = this, g = j.tabPanel, a = g.getActiveTab(), o = g.items.getCount(), k = j.getPageSize(), d = Math.floor(o / k), m = o % k, e, h, b, l, n, c, f;
        if (o > k) {
            for (e = 0; e < d; e++) {
                h = (e + 1) * k;
                b = [];
                for (l = 0; l < k; l++) {
                    f = l + h - k;
                    n = g.items.get(f);
                    b.push(j.autoGenMenuItem(n))
                }
                j.tabsMenu.add({text: j.getMenuPrefixText() + " " + (h - k + 1) + " - " + h, menu: b})
            }
            if (m > 0) {
                c = d * k;
                b = [];
                for (e = c; e < o; e++) {
                    n = g.items.get(e);
                    b.push(j.autoGenMenuItem(n))
                }
                j.tabsMenu.add({text: j.menuPrefixText + " " + (c + 1) + " - " + (c + b.length), menu: b})
            }
        } else {
            g.items.each(function (i) {
                j.tabsMenu.add(j.autoGenMenuItem(i))
            })
        }
    },
    autoGenMenuItem: function (b) {
        var a = this.getMaxText(), c = Ext.util.Format.ellipsis(b.title, a);
        return {
            text: c,
            handler: this.showTabFromMenu,
            scope: this,
            disabled: b.disabled,
            tabToShow: b,
            iconCls: b.iconCls
        }
    },
    showTabFromMenu: function (a) {
        this.tabPanel.setActiveTab(a.tabToShow)
    }
});
Ext.define("Deppon.grid.column.TipColumn", {
    extend: "Ext.grid.column.Column",
    alias: ["widget.tipcolumn"],
    tipBodyElement: null,
    tipConfig: null,
    tipBody: null,
    tip: null,
    hasListener: false,
    addMouseOverLis: function (f, d, b, c, a) {
        var e = this;
        c.each(function (g, h, i) {
            var j = Ext.get(g.internalId + "-td");
            if (j == null) {
                return
            }
            j.on("mouseover", function (n, m, l) {
                if (e.tipBody && (typeof e.tipBody.bindData) != "undefined") {
                    var k = e.tipBody.bindData(g, f, d, c, a);
                    if (!Ext.isEmpty(k)) {
                        if (!k) {
                            return
                        }
                    }
                }
                e.tip.showAt([n.browserEvent.pageX + 10, n.browserEvent.pageY + 10])
            })
        })
    },
    initComponent: function () {
        var b = this, a = b.renderer;
        if (a) {
            b.renderer = function (h, f, d, i, g, e, c) {
                h = a(h, f, d, i, g, e, c);
                h = b.defaultRenderer(h, f, d, i, g, e, c);
                return h
            }
        }
        b.defaultRenderer = function (k, g, d, f, e, l, h) {
            var i = d.internalId + "-td";
            if (Ext.isEmpty(b.tipBody)) {
                if (!Ext.isEmpty(b.tipBodyElement)) {
                    b.tipBody = Ext.create(b.tipBodyElement)
                }
            }
            if (b.tip == null) {
                if (b.tipConfig == null) {
                    b.tipConfig = {}
                }
                if (!Ext.isEmpty(b.tipBody)) {
                    b.tipConfig.items = [b.tipBody]
                }
                b.tip = Ext.create("Ext.tip.ToolTip", b.tipConfig)
            }
            g.tdAttr = 'id="' + i + '"';
            if (!b.hasListener) {
                var c, j;
                if (l.getProxy().type == "ajax" || l.getProxy().type == "jsonp" || l.getProxy().type == "direct") {
                    c = l;
                    j = "load"
                } else {
                    c = h;
                    j = "refresh"
                }
                c.on(j, function () {
                    b.addMouseOverLis(k, g, d, l, h)
                });
                h.up("grid").on("sortchange", function () {
                    b.addMouseOverLis(k, g, d, l, h)
                });
                l.on("datachanged", function () {
                    b.addMouseOverLis(k, g, d, l, h)
                });
                b.hasListener = true
            }
            return k
        };
        b.callParent(arguments)
    }
});
Ext.ux.Toast = function () {
    var b;

    function a(d, e, g) {
        var c;
        if (g == "error") {
            c = ['<div class="msg">', '<div class="top"><div class="title">' + d + "</div></div>", '<div class="middle"><div class="erroriconstyle"></div><div class="textpanelstyle"><p>' + e + "</p></div></div>", '<div class="bottom_error"></div>', "</div>"].join("")
        } else {
            c = ['<div class="msg">', '<div class="top"><div class="title">' + d + "</div></div>", '<div class="middle"><div class="okiconstyle"></div><div class="textpanelstyle"><p>' + e + "</p></div></div>", '<div class="bottom_ok"></div>', "</div>"].join("")
        }
        return c
    }

    return {
        msg: function (g, f, d, e) {
            if (!b) {
                b = Ext.DomHelper.insertFirst(document.body, {id: "msg-div"}, true)
            }
            if (Ext.isEmpty(d)) {
                d = "ok"
            }
            if (Ext.isEmpty(e)) {
                e = 4000
            }
            var c = Ext.DomHelper.append(b, {html: a(g, f, d)}, true);
            c.hide();
            c.slideIn("t").ghost("t", {delay: e, remove: true})
        }, init: function () {
        }
    }
}();
Ext.define("Deppon.ux.ZeroClipboardPlugin", {
    alias: "plugin.zeroclipboardplugin",
    targetCmpName: null,
    targetFun: null,
    targetValue: null,
    constructor: function (a) {
        var b = this;
        Ext.apply(b, a)
    },
    init: function (a) {
        var b = this, c;
        b.component = a;
        c = new Deppon.JsLoader();
        c.onSuccess = function () {
            b.initZeroClipboard()
        };
        c.load(Deppon.config.Dpap.RESOURCE_PATH + "/components/zeroclipboard/ZeroClipboard.js");
        a.on("mouseover", b.glueZeroClipboard, b)
    },
    initZeroClipboard: function () {
        var a = this;
        a.clip = new ZeroClipboard.Client();
        a.clip.setHandCursor(true);
        a.clip.addEventListener("mouseOver", Ext.bind(a.onMouseOver, a));
        a.clip.addEventListener("complete", function (b, c) {
            a.clip.hide();
            Ext.ux.Toast.msg("提示", "内容已经复制至剪切板")
        })
    },
    glueZeroClipboard: function () {
        var a = this;
        if (a.clip) {
            a.clip.destroy();
            a.clip.glue(a.component.getEl().id)
        }
        return a.clip
    },
    onMouseOver: function () {
        var b = this, c;
        if (b.targetCmpName) {
            var a = b.component.up("form").getForm().findField(b.targetCmpName);
            c = a.getValue()
        } else {
            if (b.targetFun) {
                c = b.targetFun(b.component)
            } else {
                if (b.targetValue) {
                    c = b.targetValue
                }
            }
        }
        b.clip.setText(c)
    },
    destroy: function () {
        var a = this;
        a.component.clearListeners();
        a.clip.destroy();
        delete a.component;
        delete a.clip
    }
});
